Questions tagged [scripting]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
91 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
1k 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
161 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
3k 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
176 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 ...
2
votes
2answers
131 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
48 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
69 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 '{...
-1
votes
2answers
3k 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
218 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
582 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
133 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
349 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 ...
-2
votes
2answers
363 views

Check existence of multiple network shared files

Let's say I have a list of files (files.txt), which looks like: \\myshare\file1 \\myshare\file2 \\myshare\file3 How is it possible to check via a batch script (windows) to check if those files exist ...
0
votes
1answer
10k views

Appending to an array within a ForEach-Object loop

I've run into a strange problem when attempting to append to an array from within a ForEach-Object loop that is traversing another array. I have attempted to recreate the problem as concisely as I ...
1
vote
0answers
608 views

Set-Acl : Attempted to perform an unauthorized operation while using Addaudit Rule

I am trying to run Powershell script to set Audit Rule on C:\Windows\security folder on my Windows 2008 box. Below is the script: $FileDirList = ("C:\Windows\security") $AccountName = New-Object ...
1
vote
0answers
78 views

automate server downtime for different servers at different days and time

I have created script with Ansible and also with Python to put servers down in my work environment but If I can create group of all servers and set their downtime at once. Example: If I need to put ...
1
vote
0answers
53 views

Verified data retrieval from source with limited access

Briefly: I need to download data from a linux-based device, verify data integrity, and delete the source files (can't use rsync). Details: I have a hydrophone deployed at the bottom of the ocean as ...
-1
votes
1answer
71 views

Checking if a programm is running on linux

i'm trying to check if a program on a linux server is running and start it if not. But i get strange errors: #!/bin/sh SERVICE=nrpe ps -ef | grep -v grep | grep $SERVICE | wc -l if [ $? -gt 1 ] ...
1
vote
3answers
79 views

I want the bash script to echo only if I execute and not echo if executed by a cron job

I want to echo to the terminal if the script is being executed by me, in the flesh or I want to echo to a log file if it is being done via a cron job. Ubuntu 16.04 example: #!/bin/bash if [ ***** ]...
0
votes
1answer
176 views

How to monitor VMs and its resources under google cloud (GCP)

I have couple of VMs created on Google cloud platform and deployed tomcat based applications. Now, I would like to monitor the resources (like Memory , CPU, disk , applications etc). Is there any way ...
0
votes
2answers
391 views

Script to delete many old user profiles from file server?

I have a network share on a Windows Server 2012 machine that is used to store all the user profile files (My Documents, Desktop, etc). There are hundreds of old users I need to get rid of and I am ...
0
votes
2answers
5k views

How to su non-interactively?

I want to do something like this to non-interactively switch user: su otheruser -p <password> But this obviously doens't work... what will?
0
votes
2answers
300 views

Bash script shows error for “pwd”, simple script

I'm trying to make a Bash shell script but it is not working. Here is the contents of the script: #!/bin/bash pwd I would expect this to print out the current directory. Instaed, it prints this: ...
1
vote
2answers
34 views

Can different scripts share a lockfile to ensure they don't interfere with each other?

I've used flock a lot in the past to ensure that a process only spawns once (in case it gets hung up/etc) but I've never used it for two different processes. In this scenario two different scripts ...
0
votes
1answer
74 views

script to load balance webpages

Im new with shell scripting, and I need help, to create this scripts. I have 2 apache (active/standby) servers, and what I need is to have one script that will check the status of the server 1 (wget ...
0
votes
1answer
371 views

Read all lines for .txt powershell

I have a PowerShell script that when I run it, create a local amdmistrator on the computers that I select and it gives me another txt in which they were created. But from the txt where the host ...
3
votes
1answer
8k views

Read file with parameters as parameter in powershell script

I have tried to do a powershell script the reads a file with parameters: File with parameters (params.ini): [domain] domain="google.com" [port] port="80" Powershell script that reads the file: Get-...
-1
votes
1answer
81 views

What is the os.uname prompt on ESXi [closed]

I want to check with a python script if my system runs on an ESXi but I have never worked with one. My script should only work on ESXi but I have no clue what the cli prompt would look like or how to ...
3
votes
2answers
850 views

How to check that mstsc.exe has successfully set up a RDP connection?

We use mstsc.exe to establish RDP connections to other servers in batch files, which are then terminated after some tasks have been run. This basically works fine, but every now and then it takes ...
0
votes
1answer
87 views

Can I separate shell script ifs into multiple files?

So here's is the scenario, I have a shell script that based on a network command it execute an action, it may be a service restart or stop. That part is working fine, but I'm stucked at a part that I ...
1
vote
1answer
70 views

abc='^.{2,1000}$' meaning in shell script?

I got a script & found this parameter. what will happen by using this in my script. I tried to find the way but didn't get any specific result. abc='^.{2,1000}$'
-1
votes
1answer
78 views

Remove wildcard entries between IP's in file

I have a very lengthy file(more than 4000 lines generated per day)in the following format. yqiemmtcveihai test-trans 10.227.30.66 <-----------> 14.192.17.143 <-----------> ...
2
votes
1answer
156 views

Detect spam sending script or user

I have been hired by a customer to secure his email server to prevent spam and so. They have Plesk Onyx with Postfix as MTA. I have installed incoming spam filters (barracuda, etc...), developed a ...
0
votes
1answer
2k views

'systemctl restart service' not working on CentOS 7

I have a custom service managed by an init script in /etc/init.d and, after upgrading to CentOS 7, with systemd, 'systemctl restart service' is not working correctly. I need to execute two times '...
1
vote
1answer
285 views

Storage profile error when deploying new machine using json template

I'm trying to deploy two vm's in an avset using visual studio 2015. I get the error message below when I attempt to deploy: New-AzureRmResourceGroupDeployment : 2:03:59 AM - Resource Microsoft....
1
vote
1answer
1k views

Error when deploying JSON template

I'm trying to deploy two vm's in an avset using visual studio 2015. I get the error message below when I attempt to deploy: Reference Id 1 is not formatted correctly. The Id is expected to reference ...
0
votes
2answers
39 views

HTMLDOC script multi conversion

I am trying to convert multiple htm files to pdf using HTMLDOC. I can convert a single file with the following: htmldoc --webpage -f filename.pdf sample/filename.htm. I try making a script and it ...
0
votes
2answers
89 views

Run a local script with configuration file remotely over ssh

I am trying to run a script that takes a configuration file over on a remote server. Currently I scp the file over to remote server then run the local script over on the server. script=localscript....
1
vote
0answers
32 views

how to avoid screen termination once the job is done [duplicate]

using a shell script i am ceating multiple screen in which i m running rsync cmnd with below syntax, n i m able to do so. screen -dmS "$SESSION_NAME" "$COMMAND" "$ARGUMENTS" but as soon as rsync ...
1
vote
1answer
886 views

zabbix user defined macro in script parameters (media type)

I have an alert script in zabbix 3.4 that I would like to be run using user defined macros {$FOO}, basically the macro would store a predefined value I am setting the {$FOO} in the media type (see ...
1
vote
1answer
816 views

Schedule a Script Job to run automatically but requires user interaction/input

I initially started this script for something else, thinking it would be nice for the script to handle the full process automatically, reboot, and start more script stuff. Then I realized I had a ...
10
votes
1answer
5k views

Windows - turn off high contrast mode via GPO or script?

I have a situation with a sizable deployment of Windows 10 computers and users who are turning on some truly horrific high-contrast themes, and then consuming IT resources because they can't change it ...
0
votes
1answer
59 views

getting multiple issues while creating a scrip to update hostnames in /etc/hosts file?

I'm completely new to the scripts and hence need help to fix this. We've around 3000 VMs & 450 Physical servers which are Linux based servers (few of then ubuntu starting from 9.x & few of ...
0
votes
2answers
162 views

Bash directory alias/redirect

I'm trying to compile a library and his dependencies (lots of dependencies), but the system that I'm using didn't have the usual directory structure. I'm searching for a method to "redirect" all the ...
0
votes
1answer
551 views

VBS Script passing argument?

Hello everyone I have this script in VBS: On Error Resume Next If WScript.Arguments.Count < 2 Then WScript.Echo "This script requires arguments." WScript.Quit End If Dim sURL, ...
0
votes
1answer
236 views

Powershell script - check exit code

Hi I have the following script: foreach ($server in $ProductList.$SelectedServer){ Invoke-Command -ComputerName $server -Credential domain\user -ScriptBlock { Import-Module WebAdministration echo "...
1
vote
1answer
105 views

PowerShell Script works in Windows 10 but not on Windows Embedded Standart

I have the following script work in windows 10 but not on windows 7: $LogTime = Get-Date -Format "MM-dd-yyyy_hh-mm-ss" $Path1= "TEST\TESTLog_$(get-date -f yyyy-MM-dd).txt" $AffPBS= Get-Process "...
1
vote
1answer
26 views

Sub Expression using Read-Host

Can someone please explain to me why this doesn't work? Get-Item "'\\$(Read-Host 'Specify Computer')\c$\Program Files (x86)\Microsoft Office\root\Office16\winword.exe'" "'\\$(Read-Host 'Specify ...
1
vote
1answer
124 views

Give user permission to change IP address from static to DHCP and vice-versa

Let me start by saying I am somewhat of a Linux newb. I have inherited some basic Ubuntu systems to admin (Ubuntu 16.04). I have a couple users that need to plug their machines from the network to ...