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
1
vote
1answer
21 views

Can't get a cronjob to run a script that installs a service which requires root

I need to run, on Ubuntu 18.04, via cron a script, myscript.sh that contains, among other things, installation instruction for another script, pluckeye-linux-0.99.40.installer and I'm running into a ...
0
votes
2answers
51 views

Bash script to login to server using ssh and run commands [closed]

Below is the script which i use to create user on server but everytime i need to copy the script on server.I want to create a script which ill run on my machine.ill enter dest IP adddress and hostname ...
0
votes
1answer
93 views

vi: write relative range of lines to a file

I need to be able to write a range of lines from a file to another file, I've found the :<start>,<end>w <new file> solution but what I need is to be able to search for a string and ...
0
votes
1answer
16 views

Capture client browser console using Shell and save it to a file

I want to find a way to capture a client browser console that is using my server, and save it to a file inside the server, is this possible using a shell script ?
-1
votes
1answer
26 views

Bitlocker drive encryption after PC rename or removing from domain

I've the script and gpo for the bit-locker drive encryption and it successfully writing the encryption key to the AD object. Now what I can't find anywhere to test is what will happen in case the PC ...
1
vote
2answers
36 views

Connecting to BOTH Compliance and Exchange online in Powershell using Modern Auth

In the world of basic authentication, I used to connect to MSOL, Compliance and Exchange in a series that went like this: function ConnectToCloud() { $CloudCredentials = ...
0
votes
0answers
29 views

Trying to get SSH output from within a for loop in a script

I'm trying to SSH into a bunch of hosts in order, and run a command to get a list of users on each one. Outside of a for loop, the output shows up just fine one-by-one. Inside a for loop, it ...
1
vote
1answer
26 views

How do I parse /* or */* to a bash shell script

I am trying to write a script that will let me get the arguments while running the script. I am able to do so with $@ in the script. But if I run the script with /* or */* it gives the list of all the ...
0
votes
0answers
13 views

How can I run a script triggered by a file written to a specific directory?

I have written a c program that receives a parameter from stdin in the form. The tool is compiled using gcc and I have relocated the binary to a location in my home directory, and modified the PATH ...
1
vote
2answers
85 views

PowerShell script error: the RPC server is unavailable

Im slowly getting my feet wet with Powershell, so I am a new beginner. Trying to have PS pull from a text file a list of PCs and let me know the status of their App Identity Service. The basic ...
0
votes
0answers
11 views

How to detect new USB Network Cards and call script under Windows 10?

We've a Windows 10 station that will regularly be connected to embedded devices through a USB Network adapter. The embedded device and the network adapter are "bundled" and change regularly, but all ...
2
votes
1answer
25 views

Scripting with psinfo - output IP and software version?

I'm trying to create a script that takes a list of a few hundred machines, and I'd like to have it output me three things: IP address, VMware version, and of course computername. I can't quite put it ...
0
votes
1answer
40 views

Loop do until fails after exception

do { Try{ if (New-Object System.Net.Sockets.TCPClient -ArgumentList $server,3389 ) { Write-Host $server 'Ready for RDP connection'-ForegroundColor Green } } catch { write-warning $error[0] } }...
0
votes
0answers
9 views

Respawn script on Windows

On Linux, I can create a "respawn" script very easily with this shell syntax: #!/bin/sh while true; do echo "Start my script..." python3 somescript.py >> log.txt 2>&1 done This ...
0
votes
2answers
27 views

Is there a way to set up postgres to authenticate users based on the user they are logged in as?

I want to run queries on my postgres databases from scripts and whatnot, without having to do what I do currently: sudo su - postgres psql -U USER ...etc This is cumbersome because I have to type 2 ...
3
votes
1answer
55 views

Error while checking IPv6 address using Get-NetIpAddress

Get-NetIPAddress -AddressFamily IPv6 -AddressState Preferred -SuffixOrigin DHCP | Select IPAddress I am facing the error below while executing above script. It shows the correct IPv6 configurations ...
0
votes
1answer
16 views

Automatically application deployment with python (by creating Django website)

I am having 400 machines and all are connected to VPN network and i want to deploy an application(available on server).here challenges is how to collected all real time VPN IP and logic(code) in ...
0
votes
1answer
48 views

check ip is present and update iptables openvpn

I want to check that the ip is present within the ccd folder and push the ip route to the FORWARDING chain in the iptables. Im new to bash scripting and need a little help finishing this script. ...
1
vote
1answer
110 views

Adding iptables route on openvpn connect

I have my openvpn server up and running and I push certain routes to my clients via the ccd directive, I would like to know how I can update the iptables based on the ccd files when the client ...
0
votes
2answers
33 views

Echo command, need substitution

i write a backup log script and have 2 variable in echo, but still doesn't work. My command : echo " DB-Size $(du -hs /backup/db/db_$(date +%F).sql " >> /backup/backup.log In my echo ...
0
votes
0answers
12 views

inux/unix Auto detection logic for physical keyboard layout

Anyone aware of a concise logic available to automatically detect my physical keyboard layout, so that I could do automatically set my layout table to the correct default. I'm aware that most distro-...
0
votes
1answer
20 views

Amazon EC2 only running one http script

I'm running a python script to scrapping a page in my EC2 server using screen linux though a SSH connection. My EC2 account is the free tier offered by them. Every time I try to run another script (...
0
votes
1answer
93 views

Using PsInfo with a Timeout Procedure (or piping through PsExec?)

We have a problem with people in our company leaving their computer running 24/7 even over weekends. Our corporate policy is to shut down when not in use but that doesn't always happen. So what we ...
1
vote
1answer
38 views

Pemission denied when I try to create a new file with a script

So, I have a bash script "get-data.sh that runs other two python scripts #!/bin/bash scripts=/root/scripts datos=/root/zabbixdata fecha=$(date +"%Y_%m_%d") sudo $scripts/filesystem.py > $datos/...
1
vote
1answer
30 views

Get-VM command with -Location parameter returns one result then error

i'm writing a powerCLI script and i'm facing a strange behaviour. I use connect-VIserver with administrator@vsphere.local account to connect to my VCSA 6.7 U2 server. If i use Get-VM cmdlet without ...
-1
votes
1answer
28 views

How can I recursively unarchive all files that are bzipped2?

I have a folder. In this folder I have a lot of other folders. In folders I have bzip files and non-bzip. How to unarchieve all bzip2 files in same directory where they are ?
0
votes
1answer
49 views

.bat script that moves file to a folder and adds date

I've pieced together this script to try and move a file from a folder to another, and add a date to the end of the file. It worked once, but hasn't worked since. This is my first script, and I was ...
0
votes
0answers
33 views

Keepalived - Failover when both vrrp AND track script failed

I've made a track script which is ran at each check by keepalived. When the VRRP check is failing, the BACKUP node become MASTER, even if the track script is returning 0 status (good one). I just ...
0
votes
0answers
354 views

Interactively bypass/skip part of PowerShell script

I have a script that is made up of many steps. I want it to run from start to end most of the time. Sometimes, I want to skip one of the steps. I'm looking for a "continue by default unless user ...
0
votes
0answers
36 views

How store the result of the operation in each node

I used to SLURM My SLURM configuration is One Master Node , Two Compute Node I want to Store the result of the operation in each node. So I try to this Script #! /bin/bash #SBATCH -J testing #...
0
votes
0answers
78 views

PowerShell Script to remove Security Permission from Folders

Using PowerShell, I am looking for a little help to remove certain built in domain accounts from a folder under the users Home folder. I have already written code to remove inheritance, but I can't ...
0
votes
1answer
46 views

While schedule below script through crontab receive incorrect output date format is going wrong

PFB script dd=$(perl -e 'use POSIX;print strftime "%Y%m%d",localtime time-172800;') Date=$(perl -e 'use POSIX;print strftime "%d%m%Y",localtime time-172800;') for i in `cat /path/Path_CDR.txt` do cd ...
1
vote
1answer
265 views

Powershell Get-Netadapter varible pass to Set-DnsClientServerAddress

Good day everyone, Trying to write a simple script that will find the friendly name of the Ethernet Adapter on a given machine and pass this string to the cmdlet 'Set-DnsClientServerAddress' so that ...
0
votes
1answer
54 views

Removing empty List in output as result [closed]

I have a simple script as following: import re wanted_line = [] with open('lines.txt','rt') as myfile: for myline in myfile: wanted_line = re.findall('ticket/\d+',myline) print(wanted_line[:...
2
votes
2answers
688 views

Change Registry Key Permissions Access Control List using only Command Prompt

I am trying to change the Access Control permissions on a specific registry key i'm generating using a batch file. I try using regini.exe to pull the configuration from a .ini file and run into ...
2
votes
1answer
85 views

Faster way to add IP scopes to Item Level Targeting?

I have a GPO with printers mapped via the user preferences. Each printer needs to be item-level targeted only to computers in a specific IP range. I have a list of about 92 ranges that need to be ...
0
votes
1answer
44 views

Is running a script a process? [closed]

I run ./install.sh and I tried to background it to be able to close the ssh session. But after running bg the process is again outputting to the terminal. Also, I don't see anything with jobs. ...
2
votes
2answers
137 views

Net.HttpWebRequest difference between Powershell and PowerShell Core

Hoping someone can shed light on this. In Powershell, the following code generates output of the website certificate: $req = [Net.HttpWebRequest]::Create('https://www.google.com') $req.GetResponse() $...
0
votes
0answers
88 views

how to dynamicalle change the acl in haproxy?

haproxy.cfg frontend http-in mode http bind 206.189.22.155:80 acl path-page-designer path_beg -i $PATH use_backend page-designer-backend if path-page-designer ...
0
votes
0answers
17 views

Script for warming Varnish

I have a setup for ecommerce site with Nginx and Varnish. Although I have a cache warmer in my php application I need a script in server level which will load a txt file for hitting with curl some ...
0
votes
0answers
38 views

Running a script on all servers behind a loadbalancer in aws

I've a task in hand where I've to run a script on all the servers behind a load balancer in aws. We have auto-scaling as well so at the time of high load, new servers get added behind the same load ...
0
votes
1answer
361 views

Script to storage vmotion from one datastore to another

Ive done some searching and could not find what I'm looking for so I am making a post: I would like to storage vMotion from one datastore to another, 10 at a time, and output the vm's migrated to a ...
1
vote
0answers
41 views

How to configure a https proxy with JVM command line arguments?

I am trying to create a container with Docker that contains eclipse and some plugins. By now, I am trying to configure the proxy that I need for internet connexion and it works for the http but not ...
0
votes
1answer
25 views

Perl - SSH and run backup while retain the session

Hope someone can help me here. Looking to redo my bash ssh script for cisco devices, and add on to it. Basically, my idea is to have an SSH to log me to the device in enable mode (so i can do regular ...
0
votes
0answers
17 views

Change Internal Microphone properties via script

I have been asked to write a script (or GPO) to push the following to a good amount of clients... However I have been unable to find a way to accomplish this, all I find is how to change volume, ...
0
votes
0answers
313 views

Cannot shut down WildFly 9.0.2 with CLI

I'm trying to shut down WildFly 9.0.2 with a script (Windows Server). Everything I have read online point to the same command: jboss-cli.bat --controller=localhost:9990 --connect --command=:shutdown ...
0
votes
0answers
84 views

PowerShell function parameter becomes null inside try block

I'm putting together a powershell zip in transit script that would be called via a function, but it keeps saying the path is null after it creates the zip file. After running the script in ISE I then ...
0
votes
0answers
18 views

Schedule access to windows network share (grant, revoke permissions on certain date for certain user)

We are looking at automating the task of granting and revoking Windows network share permissions to certain users (apprentices) that move through different departments in the company. Each time they ...
0
votes
0answers
44 views

cron job not working in unix but works when executed manually [duplicate]

I am running a cron job everyday at 21:00 UTC which downloads few csv files from sftp server, renames the downloaded files and then loads the files in database(mysql) and updates the time in database (...
0
votes
0answers
206 views

TMUX not creating sessions from CRONTAB

I'm having a heck of a time getting a tmux session to be created from a script executed by crontab. The script executes and the session is created without fail from just running it but if I run it ...

1
2 3 4 5
34