Skip to main content

Questions tagged [shell-scripting]

Programming in an Interpreted language executed by a running Shell

0 votes
0 answers
25 views

see below details eccdbpvm02:/mnt/HANA/E1P/backup/data/DB_F1P # crontab -l 05 00 * * * /usr/sys_scripts/clear_log >> /usr/sys_scripts/log.txt 2>&1 eccdbpvm02:/mnt/HANA/E1P/backup/data/...
Henokert Del Rosario's user avatar
1 vote
1 answer
122 views

I have a couple of custom scripts to help me with more or less regular tasks; and recently decided to move them from /usr/bin to ~/bin to have a better overview. I also added home/myusername/bin to $...
Titus's user avatar
  • 271
0 votes
1 answer
60 views

I have an HTTP server (source code not accessible and cannot be substituted at this time) running on my Linux machine, which can be configured to execute any commands on requested. However, the HTTP ...
Gamcheong's user avatar
0 votes
0 answers
129 views

I have a containerised command I'd like to run: docker run my_docker_image. Rather than install the command's dependencies into the main computer, I'm packaging them all into an image, that then users ...
Rob Grant's user avatar
  • 103
1 vote
2 answers
825 views

I a bash script, I want to obtain the global IPv6 address of my machine for a given network adapter (on my case 'ens18'). To get started, I issued the following command: ip -6 addr This gives me the ...
Boris's user avatar
  • 113
0 votes
1 answer
108 views

I'm trying to write a script that will read search strings from an input file and then execute a command with $string in the middle of the command line. This is an example of the working command line:...
Drew's user avatar
  • 101
0 votes
1 answer
152 views

When I run command bellow in bash shell : if [[ $(readonly | cut -d= -f1 | grep -qo HISTFILE && echo $?) == 0 ]]; then sudo grep -iwo "readonly HISTFILE" /etc/profile /etc/profile.d/*...
M. Fachrizal Utama's user avatar
1 vote
1 answer
301 views

code : subject="mail subject" body="Hello World" from="[email protected]" to="[email protected]" echo -e "Subject:${subject}\n${body}" | sendmail -f "...
Nitin Alety's user avatar
0 votes
1 answer
1k views

I have monit utility on production for monitoring several daemons (our micro-services). I'm trying to figure the best way to unmonitor/monitor my daemons while updating them. So, basically I need ...
Alexander Bell's user avatar
-1 votes
1 answer
96 views

From a.pdf, I would like pages 2 and 5 b.pdf, pages 3 and 4 c.pdf, pages 7, 8, and 9 copied into a new PDF file. All input pdf files are ten pages long. I'm using bash, and plan to make many ...
lmat - Reinstate Monica's user avatar
0 votes
2 answers
58 views

Hi I am new to shell scripting ,I am trying to see how many times an accounts were logged in the log file. If an account was logged in more than 20 time I need the name of those accounts to be printed....
NJN's user avatar
  • 1
0 votes
1 answer
421 views

Objective: I want to trigger a webhook on a private linux-machine (its a local system not connected to internet), which can delete the spool data generated by CUPS server in /var/tmp folder. To ...
Sheikh Muhammed Tadeeb's user avatar
0 votes
1 answer
100 views

I need to measure the time that Firefox takes to build itself from the source code. Here's what I do normaly: nohup ./mach build > my_log.log & I then prepended time to it: time nohup ./mach ...
Kentuk's user avatar
  • 1
-1 votes
1 answer
260 views

I have a file that looks like the following: /path/to/a/very/long/path 0 0 0 0 0 0 I need to move the line starting with a number (this can be any value not necessarily 0) to the end of the ...
djc72uk's user avatar
  • 33
1 vote
1 answer
143 views

In the case of a simple web-server with a MySQL database, the script has to dump the database, copy the web-server files and tar everything together. Then a NAS server Rsync the tar file via a "...
Danilo Steps's user avatar
0 votes
1 answer
81 views

am working on a scenario where i need to Change Ubuntu server password every 7 days and do autologin. i tried with breaking the problem: command to create user with password: useradd -p $(openssl ...
user9990's user avatar
0 votes
2 answers
407 views

I've always struggled with various paths for nginx files and where they should be positioned. As we know, we can change where we can park both the www directories for our web app, as well as the ...
Rich_F's user avatar
  • 125
2 votes
0 answers
327 views

On ESXi Hypervisor, If I run a command on the terminal via SSH, the commands are logged in the shell.log file, i.e if i run this command [root@esxi04:~] ls -la then I can see this command in shell.log ...
Cool Guy's user avatar
0 votes
1 answer
891 views

I'm trying to copy data from psql via a bash script now I'm stuck with a loop my bash script is as following: #!/bin/bash DATEBEGIN=2016-03-01 DATEEND=2016-03-31 DATEMONTH=2016-03 echo "Copy ...
Sander Böhm's user avatar
0 votes
1 answer
4k views

I'm trying to run a Docker container based on: PHP 8.1 Apache 2.4 MariaDB (latest official docker image) Dockerfile: FROM php:8.1-apache WORKDIR /var/www/html/ RUN pecl install xdebug \ &&...
DevelJoe's user avatar
  • 259
0 votes
0 answers
90 views

I have the below script running successfully manually. But when it is executed in crontab (below), I dont see anything happening. Script #!/usr/bin/gawk -f #!/bin/bash PATH=/usr/local/bin:/usr/bin #...
serverstackqns's user avatar
0 votes
1 answer
208 views

How can I add a variable within awk command? below is my command: cat /home/ubuntu/test/copy.txt | awk 'NR==21{print ".host = "$line";"}1' $line is basically an IP address which ...
serverstackqns's user avatar
1 vote
1 answer
986 views

I'm trying to build a script that I need to be quite able to manage directory with spaces or/and backslashes in their name or not. Inside a bash script or directly on bash shell using variables for ...
SimoneM's user avatar
  • 121
1 vote
1 answer
273 views

I have 2 HA Proxy servers with Keepalived configured with them, and have 2 backend servers to which traffic is routed by HA Proxy, am writing a shell script that will sync a directory between backend ...
MoonLight's user avatar
  • 111
1 vote
1 answer
57 views

I am trying to automatically set the root password to random characters via bash script. The script is part of a Vagrant shell provisioner. If the script runs the password change only, I am able to ...
Utkonos's user avatar
  • 398
1 vote
1 answer
605 views

I am in need to check free space on servers but I am getting more than enough details. DeviceID : C: DriveType : 3 ProviderName : FreeSpace : 76691152896 Size : 160482455552 ...
Newb_969's user avatar
1 vote
0 answers
147 views

I have a html main.txt file, I need help to split it in two parts. headpart.txt and bodypart.txt. Below is my html main.txt text file - Original <p class=\"auto-cursor-target\"><br /...
Goural's user avatar
  • 45
7 votes
4 answers
5k views

I have a domain name in a bash variable ($TARGET), and I want to get the IPv4 (A record) address of it in my bash script (I also want to get the IPv6 AAAA record (if exists)), in a robust manner. i.e. ...
Amandasaurus's user avatar
  • 33.8k
2 votes
1 answer
4k views

I have a shell script that runs on a FreeBSD machine. The script has some commands that needs superuser privileges. I’m executing the script remotely and it’s skipping the sudo’d commands. I tried the ...
ossama assaghir's user avatar
1 vote
1 answer
5k views

I wonder anyone can help me with making a shell script which automate aws cli process for: 1.Creating Security group 2.Set roles to this Security group port 22 and port 80 3.Create a ec2 instance with ...
rikorey's user avatar
  • 15
0 votes
1 answer
68 views

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:...
flexman's user avatar
0 votes
0 answers
476 views

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 ...
Amandasaurus's user avatar
  • 33.8k
1 vote
1 answer
337 views

I'm calling a script inside another script: ... ... powershell C:/temp/script2.ps1" ... ... That joins a VM to a domain after downloading some things. However, when the script runs, the prompt ...
rumplesmyboy's user avatar
-1 votes
1 answer
712 views

As part of automation in gitlab ci. I am running a terraform template and creating a linux machine. After that, I need to run few commands on the remote machine. I am running those using the ssh ...
Kalel's user avatar
  • 264
1 vote
1 answer
3k views

I have a bash script who automate a Nextcloud server installation. To run MySQL commands I use the mysql -e command user@hostname:~$ mysql -e "CREATE DATABASE ‘NextcloudDataBaseName’" I ...
Maxime's user avatar
  • 79
0 votes
0 answers
121 views

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 ...
Himanshuman's user avatar
0 votes
0 answers
2k views

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 ...
Satish Lamak's user avatar
0 votes
1 answer
659 views

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 ...
Rajesh Yidi's user avatar
0 votes
0 answers
838 views

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 ...
Satish Lamak's user avatar
0 votes
1 answer
154 views

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 $...
serverstackqns's user avatar
0 votes
1 answer
596 views

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 && ...
serverstackqns's user avatar
0 votes
1 answer
1k views

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@...
Ramon Smits's user avatar
0 votes
1 answer
212 views

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 ...
Pete's user avatar
  • 133
0 votes
1 answer
548 views

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/...
ihorc's user avatar
  • 53
0 votes
1 answer
257 views

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 ...
deokyong song's user avatar
-3 votes
1 answer
79 views

I recently took backup of one of my server's drive on AWS using one of the software and now at the time of restoring it i found out it took too long to restore as its having billions of files to ...
root's user avatar
  • 39
0 votes
1 answer
511 views

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) ...
Bangy's user avatar
  • 1
0 votes
0 answers
330 views

I know that within the interactive 'top' screen, I can press 'Shift + i' to turn off 'Irix mode' Is there a way to do the same thing with 'ps' command? I am trying the below mini script to print out ...
Asem Abuelhija's user avatar
1 vote
0 answers
934 views

I have a digital certificate that I'm using for a specific task. I need to export the details of the certificate such as the serial number and issuer to a csv file that is already on my computer using ...
Darius's user avatar
  • 11
0 votes
1 answer
7k views

I am new here and I facing issues with my powershell script whith long paths. This script aims to get relative path and hash from files/folders and its subfolders. It works with some with others I get ...
ed7's user avatar
  • 11

1
2 3 4 5
13