Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [scripting]

A form of computer programming that — in the context of system administration — lends it self well to automating tasks.

1
vote
0answers
9 views

Double bracket missing in Oracle Linux

So I was trying to write a script in an Oracle Linux server and nothing worked. To begin with, there is no double bracket as far as I can tell. Also, the error messages I get are weird. For instance, ...
0
votes
1answer
37 views

Count down date time shell script [closed]

i have 3 parameters of date "Sep 30 Mon" (Month,DayNumber,Day), and i want to make a shell script that shows the quantity of days left to reach to Sep 30 Mon. How can i do it?
0
votes
1answer
71 views

Batch Script for service restart and alerting over email

Please let me know what i am doing wrong in my code. I am trying to check a set of Services starting with specific set of name. And triggering an email if service is in stop state. I have made a loop ...
0
votes
1answer
24 views

Script to check exe files version

I would like to know the version of all exe files in D: Drive (right click the exe, details tab, "Product version" field) I have done a script which include sigcheck.exe from Sysinternals Suite; it ...
1
vote
1answer
42 views

Enter at the end of a specific line

I have the following file.txt that follows the same pattern and I want to modify it where this file is by adding an ip: # gfhfhgfh gfhfghgfhgfhgfh MACs # access USER CONSOLA *,!10.249.247.3,!10.249....
2
votes
1answer
36 views

Powershell, how to compare user input

I'm making a "shortcut" PS1 script to update a domain user's password. I'd like to prompt the user for the new password twice without showing the password on screen. When I use $Text1=Read-Host ; $...
0
votes
1answer
64 views

How to prevent empty subelement list error in Ansible loop?

When I try to loop (with Ansible 2.6 loop) with subelements through all public keys of a list of users and encounter a user which has no public keys defined: - authorized_key: user: "{{ item.0....
1
vote
1answer
22 views

How do I get Postfix to run a script every time there is a outgoing delivery error?

I would like postfix to run a external php script (a hook) every time there is a outgoing delivery error. For example, my webserver sends out emails and sometimes the recipients mailbox is full or ...
0
votes
1answer
32 views

Expect Scripting: Is there a way to default back to a previous spawn_id?

After I scp a file using spawn, the spawn_id, exp8, closes out. gets eof. so, any other commands I run after that, I get this message: an not find channel named "exp8". So I'm assuming that once a ...
-1
votes
1answer
53 views

Script on Linux only gives me “no such file or directory” [closed]

I've come across a problem, I am writing a script that would find the biggest file in directory and sub-directories, then show full path on screen. Can't seem to get it working. The error I'm getting ...
1
vote
1answer
13 views

save hdf5 data when admin kills script

I have a lot of Monte-Carlo data that I need to process at a particular cluster. What I do is, for a given data sample (which is on average of size 70 GB), I run some statistics script in python on ...
1
vote
1answer
152 views

Creating a new AD LDS instance without the Setup Wizard?

Is the installation of a new unique instance of AD LDS (using either cmd or PowerShell) possible? All resources I can find online just use the Active Directory Lightweight Directory Services Setup ...
0
votes
0answers
46 views

Run none Linux command in shell script

I am running the following code to telnet to a server via a shell script. #!/bin/sh (echo myusername; echo mypassword ; cat) | telnet -l myusername 127.0.0.1 After successful login, my shell changes ...
1
vote
0answers
26 views

Multi VPS: Best practice for semi-automated upgrades?

I've got many virtual private servers, each needing some apt-get upgrade -y lovin' from time to time. (Ubuntu 18.04) Problems I face: I don't have time to upgrade each one manually. I don't want to ...
0
votes
2answers
16 views

automate settings change on multiple power appliances

I'm trying to automate the task of changing settings on 100+ power appliances via SSH but each settings change has multiple interactive prompts. Is this possible or does anyone have an example of how ...
2
votes
1answer
28 views

Converting Microsoft Security Essentials DateTime in registery to readable format

I am trying to get some data from the Windows Registery using Windows Powershell (5.0+), specifically data of Microsoft Security Essentials. I managed to decode almost all of it and convert it to a ...
0
votes
1answer
37 views

How can I compute only current instance disks

I need some help with Google cloud. I need a shell script for creating a current instance snapshot. I have researched and found some shell script which can create snapshots for all project instances, ...
2
votes
1answer
52 views

Changing PF rules on the fly to mitigate damage of DDoS (OpenBSD 6.4)

This is a two part question, really. Keep in mind that I am a developer not a system admin, but being the only employee in the company, I wear ALL the hats. I have deployed my server with two ...
1
vote
1answer
71 views

Script to count of unique users logged in to remote desktop server?

I am trying to create a web interface to allow us to monitor how many users are logged in to our 2008r2 terminal server farm. I have a script that is a good starting point and I have tweaked it for ...
0
votes
1answer
24 views

Get-Command Changing Drive

I wrote a powershell script that includes a check for the invoke-sqlcmd cmdlet. Script runs fine under Windows Server 2016. On 2012 R2, the script fails with: Add-Content : Cannot use interface... ...
0
votes
0answers
30 views

Get errors from Tomcat log in real time

I need to make a script to get certain errors from Tomcat log or maybe get them before Tomcat prints the erros to catalina.out. After getting error X, Y or Z, I want it to run a certain command, like ...
0
votes
1answer
22 views

Using credential name to map network folder that has identical form

We have a network share over vpn to a windows server in a different city. each person has a username to access the folder (and only that specific folder) his/her folder is same as username. user os is ...
1
vote
1answer
75 views

Crontab influences bash script if condition?

I am a bit baffled here, and not really sure how to debug this. I have a self-written bash script, that checks if a samba share is active, and if not, sends me an email. Script is in /root/SKRIPTS/, ...
0
votes
1answer
76 views

Deploy MSI via GPO to specific users “Admin right issue”

I'm trying to deploy an MSI via GPO to specific users (120 users) from different departments and sites, the problem is that they don't have admin rights so the application cannot be installed due to ...
-1
votes
1answer
26 views

Command that returns exit code still returning 0 when using “command 2>&1 | tee -a /var/log/file.log”

I'm running a script that executes a command and save the output to a file in /var/log. After that, it gets the exit code and execute another command based on an if/else condition. The problem is: 2>&...
1
vote
0answers
70 views

Allow standard user to modify HKCU registry from script

I'm writing a batch script to launch a program for my Citrix environment and I'm running into some issues with a couple of reg keys I'm trying to set in the script. essentially I'm launching an ...
0
votes
1answer
66 views

How to execute 2 scripts on a server via ssh by chaining them and within only a single connection? [closed]

I have these 2 commands that I send to my server: - cat ./script1.sh var1 var2 | ssh my_user@my_server.com - cat ./script2.sh var3 var4 | ssh my_user@my_server.com This is a part of Gitlab CI, but ...
-2
votes
2answers
54 views

“kill -9 …” throws a warning when it's run from a script [closed]

In my script I have this: #!/bin/bash kill -9 $(ps aux | grep '[m]y_app' | awk '{print $2}') sleep 3 ENV_VAR=val123 nohup my_app & Why does it print this: kill: usage: kill [-s sigspec | -n ...
-2
votes
3answers
69 views

SSH to server as one user, switch to root and create mysql dump - how to script this

I want to be able to copy a mysqdump from a remote server to my local machine. I had a script to do this, but our operations guys have now changed the server permissions and it doesn't work. So ...
0
votes
2answers
625 views

Copy files to network drive with powershell script and task schedule

I have powershell script that is copying files from local drive to network mapped drive. Everything works fine when i run this script via powershell but when i run this script with task scheduler it ...
0
votes
0answers
103 views

How to use “sudo” for installing an app on gitlab.com for CI?

I have a project at gitlab. I'm setting up Continious Integration for it. I need to install sphinx search engine and it requires sudo. - http://sphinxsearch.com/files/sphinx-3.0.3-facc3fb-linux-amd64....
-1
votes
1answer
121 views

Run commands in fish from bash script?

I have a rather long bash script for setting up a server cluster. I'd like to start switching over to fish interpreter but I'd like to do it in steps. Can I keep my bash script as is and add the fish ...
3
votes
1answer
165 views

Do group policy shutdown scripts run before Windows Services shut down?

You can have a [shutdown] section in group policy which specifies some scripts to run during system shutdown. Do all these scripts run before Windows services start receiving 'Preshutdown' ...
0
votes
0answers
184 views

powershell - get from ad group user name and they group

in my AD I have security group "Citrix" and in this group I have added a lot of groups "Citrix 1", "Citrix 2", and more... in this group has add users. I need to get information with powershell users ...
0
votes
0answers
19 views

INotify: Treatment of bulk moves vs. individual files

Our environment is making use of inotify events for the purpose of triggering file transfers, but with our lab being a closed environment it is difficult to replicate inbound streaming file writes. ...
0
votes
1answer
35 views

List all Linux servers where my account was created

I'm a new Linux sys. admin (in the past, Windows sysadmin) We have 400 and more Linux servers. On some servers my account is create and on some not. I want to know wich server I have to ask for ...
0
votes
1answer
50 views

debian cron.hourly script not executing

New to cron on debian 9 , I have a file called ipupdate in /etc/cron.hourly/ipupdate -rwxr-xr-x 1 root root 132 Jul 11 18:21 ipupdate the file has a single curl command like this: curl "https://..."...
0
votes
2answers
712 views

CentOS 7 custom service failure (Interactive authentication required)

I am trying to setup an OFBiz fork called Scipio as a service on CentOS 7. The service wrapper script changes the user to a dedicated one for the program. All of the program's files are owned and in ...
1
vote
0answers
106 views

Set Windows 10 Default Start Layout

How can we set the default start layout and task bar icons for each user in Windows 10, yet still let users modify them later? I know you can use an XML file to set these, but a standard XML file ...
0
votes
1answer
2k views

how to open sftp connection and execute sftp commands in shell script?

I need to connect to multiple SFTP connections and copy files to my system. I will maintain one CSV file in our local system. It will have multiple partners' information of username, password, ...
0
votes
1answer
143 views

Powershell - piping in related variables from a list

I am trying to export formatted folder ACL permission list for a limited set of folders on a file server. I have a list of folders to read out permissions from and a list of file names that I want to ...
3
votes
2answers
120 views

How to run a script on a server 1 minute after a commit has been made?

Apart from creating a 2nd script which would check the time of the last commit and then run the main script and which would be too complex of a solution, is there a simpler one?
1
vote
0answers
44 views

ideas needed - cut the smb connection when disk full

Hello sometimes we are having issues like when some misbehaving user copies files to a server via admin share or other share and he causes disk drive to fill and a p1 ticket be created by monitoring. ...
0
votes
0answers
42 views

debian 9 script to add sudo user

I was trying to make a script to set up a sudo user . Copy pasting one by one Debian commands work , but not running in script . Debian9=$(lsb_release -a 2>/dev/null | grep '^Description' | awk '{...
0
votes
0answers
39 views

What are the Non-GPO settings like Fine-Grain Policy settings that affect AD objects in Windows AD environment

I would like to know the list of possible settings available in Windows AD environment (irrespective of version) that are Non-GPO settings which could be used to modify the configuration of an AD ...
-1
votes
3answers
1k views

Bash script: save last line output from terminal

I am writing a bash script in which I would like to save the output of the last command in to a variable before running my next one so I can display it later. I have tried a few different methods ...
2
votes
1answer
122 views

fdisk with a a single command fail in the second execution

I ran a script to format a disk with fdisk like this: (echo n; echo p; echo $number_part; echo $firs_sector; echo $second_sector; echo t; echo $format; echo p; echo w) | fdisk /dev/$disk when i ...
1
vote
0answers
170 views

remote powershell unrecognized command when calling functions

I have two servers. Server A needs to contact server B and run a specific function withing a powershell function library (just a .ps1 file) that I've created. The function that is being called also ...
0
votes
0answers
31 views

Making post alert script for snort

I`m trying to make a script that trigger an action if 5 snort rules ware broken in 24 hours interval. I`m putting all my snort logs in alert.log Can some one help me to make a script that motor this ...
0
votes
1answer
132 views

Appending deployment.properties to enable TLS

I need to be able to append everyone's deployment.properties file to add additional lines to enable all versions of TLS. Big enterprise uses multiple different versions of Java and also multiple ...