Questions tagged [shell-scripting]

Programming in an Interpreted language executed by a running Shell

Generic programming in an Interpreted language (as opposed to compiled) executed by a running Shell. Sometimes referred to as "Glue Code" due to the practice of managing the execution and output of one or more compiled binaries and passing said output to another series of commands.

621 questions
0
votes
0 answers

It's not making shell script of modsecurity after compiling from source. modsecurity v2.9

I compile modsecurity from source. But it's not making the executable shell script. How can I get the modsecurity shell script? I went back to back but didn't get the shell yet. any help?. root@3c6a29e9f9b5:/home/modsecurity-2.9.3# ./configure…
kolo
  • 1
  • 2
0
votes
1 answer

Remove bunch of disconnected LUNs by shell script (regex issue)

Have a problem with my script, don't want to run same procedure 200 times with changing LUN number. Remove the multipath device from ALL paths to the LUN, run echo 1 > /sys/bus/scsi/devices/${H:B:T:L}/delete (Where H = host:B = bus:T = target:L =…
flexman
  • 1
  • 1
0
votes
0 answers

Script for automating rsync between two machines (ssh, rsync, mysqldump involved)

I'm trying to create a bash script to automate a process that backups my WordPress blog (on a VPS) on my NAS. I always do it manually, but I'd like to just launch a command and let the thing do its work. What I do usually: On the NAS ssh…
javipas
  • 1,332
  • 3
  • 23
  • 38
0
votes
0 answers

Can a bash script detect if it's **not** being run inside a `systemd` service?

I have a bash script. This script can be started as part of a systemd service (or transient systemd task with systemd-run). One can also run it stand alone. How can I see if “the current script” is being run as part of a systemd service? I can see…
Amandasaurus
  • 31,471
  • 65
  • 192
  • 253
0
votes
0 answers

Script to reassign floating IP address to my other machine running Ubuntu

I have a floating IP(X.X.X.191) assigned to the machine (Y.Y.Y.106) currently running ubuntu. Now I want the same floating IP to be assigned to my other droplet(Z.Z.Z.252). On digital ocean I can do the same from the web app interface. However I…
0
votes
0 answers

How to pass multiple arguments through ssh and use those arguments in the ssh script?

I have written one script on lets say server1 and from that script I want to execute script Start_UI_AdminApp.sh on server2 through ssh. I also need to pass the arguments while executing this ssh command. So that i have to use those arguments in…
Satish Lamak
  • 51
  • 1
  • 3
  • 7
0
votes
1 answer

Shell script to check resolv.conf

I need to write a shell script which checks the contents of resolv.conf Eg domain example.com search abc.com abc.org abc.net nameserver 1.1.2.2 nameserver 3.3.4.4 abc.com/abc.org/abc.net can appear in any order nameserver line can appear in any…
0
votes
0 answers

When calling script from jenkins it is not working as expected

we have one react application and start it using pm2 with pm2 start manually. We have written one script to run it, it is working as expected when we run script manually on server. But when calling from jenkins it is not working as expected. Below…
Satish Lamak
  • 51
  • 1
  • 3
  • 7
0
votes
1 answer

Shell script not reading the file as expected

Below is the script trying to be executed: read n for ((i=1;i<=$n;i++)) do file=createserver"$i".json echo $file instanceid[$i-1]=$(jq -r '.instance.id' ./$file) echo $instanceid done $file displays correct value. However, $instanceid is not. The…
serverstackqns
  • 764
  • 3
  • 16
  • 42
0
votes
1 answer

Variables on set-hostname and mv command in shell script

I have the below script in Shell: read n for ((i=1;i<=$n;i++)) do echo "Connecting to $publicip" ssh -i ./key.txt root@$publicip 'hostnamectl set-hostname autotest$i.domain.com && mv /etc/letsencrypt/live/autotest.domain.com…
serverstackqns
  • 764
  • 3
  • 16
  • 42
0
votes
1 answer

Run commands that run in a shell as a script

Running the following commands in a shell runs without issues: ssh user@machine systemctl status my-service.service ssh user@machine sudo systemctl stop my-service.service scp -r ./my-service/* user@machine:/home/user/my-service ssh user@machine…
Ramon Smits
  • 145
  • 9
0
votes
1 answer

Shell Script to Move a File Into Another User's Directory?

I'm running a Ubuntu 16.04 server. On my server, I have a file in directory /home/userA/dirA: userA@myUbuntu:~$ userA@myUbuntu:~$ pwd /home/userA userA@myUbuntu:~$ userA@myUbuntu:~$ ls -l total 8 drwxrwxr-x 3 userA userA 4096 Feb 17 14:13…
Pete
  • 131
  • 6
0
votes
1 answer

Using awk with column number in a bash script

I'm using a command like this to get some connections from nf_conntrack: awk '($3 == "tcp") && ($6 != "TIME_WAIT") && ($10 == "dport=1234")' /proc/net/nf_conntrack How to use this command inside of a bash script and also add a script argument to…
ihorc
  • 43
  • 6
0
votes
1 answer

How monitor open files and kill its PID by shell script?

My system gets me an error that saying 'Too many open files'. I investigated this error and turned out that /usr/bin/uwsgi created sockets(?) more than 1020. If it creates more than 1020, I guess, the above error comes up with. So What I try to do…
deokyong song
  • 13
  • 1
  • 3
0
votes
1 answer

Automating GDB memory dumps

I'm trying to dump memory from a process on my Linux machine using GDB, but I'm trying to automate this using a script. So far I've been using the following commands (example): $ gdb --pid [pid] (gdb) dump memory dump_file 0x00621000 0x00622000 Is…