Questions tagged [bash]

Bash is the Bourne Again SHell, the successor to the classic Unix sh (shell).

bash is the Bourne Again SHell, the successor to the classic Unix Bourne shell (sh). It's the default shell on many Linux distributions, including RedHat, CentOS, Debian, and Ubuntu.

The premier online guide is the BashGuide.

3527 questions
1
vote
1 answer

PyCharm on Windows 10, how to use WSL ubuntu bash to run shell scripts?

I have installed PyCharm Community Edition on Windows 10, my Windows also has WSL Ubuntu installed. We know that PyCharm on Linux can create and run shell scripts because PyCharm use the /bin/bash on Linux. But on Windows, PyCharm doesn't know where…
1
vote
0 answers

rsync error: syntax or usage error - when using bash script

Problematic code: if [[ $remote == y ]]; then RSYNCOPTIONS="&& $SSHOPTIONS $BKUSER@$BKSVR mv incomplete_back-$date $2 && rm -f current && ln -s $2 current" else RSYNCOPTIONS="mv /backup/incomplete_back-$date /backup/$2 && rm -f /backup/current…
JCats
  • 87
  • 2
  • 13
1
vote
1 answer

Rsync doesn't work in script

I have 3 servers. On 1 server i have 2 scripts: 1st script: ssh root@1.1.1.2 'bash -s' < 2.sh 2nd script: rsync -av --update /root/backup/* root@1.1.1.3:/root/backup/ I want to connect from 1st server with 1st script by ssh to 2nd server and…
Epic555
  • 131
  • 5
1
vote
3 answers

How to run a shell script on a server farm periodically

I have a requirement to collect custom metrics (a shell script) from a logical server cluster every five minutes. This server cluster consists of 10 virtual machines. Once option i am familiar with is creating cron jobs on every one of these VMs and…
kn9
  • 11
  • 1
1
vote
1 answer

Shell script prevent switching to other shell or escape from it

If in my automation script, I need to do something like install oh-my-zsh, I will have a .sh script like this: #!/bin/sh runuser -l user -c 'sh -c "$(curl -fsSL…
xendi
  • 414
  • 5
  • 10
  • 22
1
vote
1 answer

Port is added to IP table but why not listening?

I have two centos Machine, Machine A and Machine B. In machine A i have installed collectd and influxdb. So, the system metric from machine A is pushed into influxdb using collectd. I have installed collectd in machine B. Now, I need to push the…
1
vote
0 answers

How to create Stealth or DMZ Name Server?

We need to create an Stealth (DMZ, Split or Hidden Master) Name Server. We are able to create Name Server for our private network and our sub-domain's are resolve in our Local Area Network where not in World Wide! Would you please help us to resolve…
Śhāhēēd
  • 111
  • 4
1
vote
1 answer

Download |parse pem file aws secret manager

I have placed pem file as a key value on AWS Secret Manager. When I downloaded the pem file it downloaded as following format. -----BEGIN RSA PRIVATE KEY-----EncryptedText==-----END RSA PRIVATE KEY ----- How can I convert this to correct pem file…
Vikash
  • 141
  • 4
1
vote
0 answers

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 from crontab the session isn't created and it…
Tyler C
  • 119
  • 6
1
vote
1 answer

How can I make an environment variable visible to a script placed in /etc/cron.daily?

Say I have a script named "mydailyscript" containing the following: #!/bin/bash if [ ! -z $MYDAILYLOG]; then exec 1>$MYDAILYLOG fi echo This script ran on $(date) and I then copy this script to /etc/cron.daily. Where do I define the environment…
1
vote
3 answers

Kickstart CentOS 7 with pre-defined static IP and hostname (%pre) and used in KS, possible?

I don't know if this is possible, but going to ask anyways. I am trying to Kickstart newer servers of us with CentOS 7. So far I got most working, however for some reason if I use variables in the %pre section of my Kickstart script, then it does…
HudsonHawk
  • 103
  • 2
  • 14
1
vote
2 answers

Change first character pattern in a file name without changing that same pattern elsewhere in the file name

On a Linux server I have a directory full of files with digits for names. Some of the files start with two zeros such as 00305005. I am writing a bash shell script and one of the steps is to rename all of the files that start with 00 so they start…
DavevaD
  • 23
  • 6
1
vote
3 answers

Writing precisely values of bash script output

I have the following command: $ snmpnetstat -v2c -c public -Cs -Cp udp 10.10.0.32 that has the output: udp: 198 total datagrams received 65 datagrams to invalid port 0 datagrams dropped due to errors …
Tim Luka
  • 147
  • 2
  • 8
1
vote
1 answer

search string for regex and return value

i need a string checked for an Regex and the Match should be returned into a variable. I read line by line through the data, and for that, i have some data i have to extract from that line. I checked that line for an value, if that is true, i need…
1
vote
2 answers

ssh remote won't run if

This won't run, ssh -o ConnectTimeout=10 -o BatchMode=yes -o "StrictHostKeyChecking no" -q server1 "if [[ $(/usr/bin/lsblk /dev/sde | wc -l) = 2 ]]; then echo found; fi" But if I do it on the remote cli or using ansible "if [[ $(/usr/bin/lsblk…
Ricky Vene
  • 21
  • 1
  • 1
  • 4