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
2 answers

Ensuring network drives are mounted before performing a backup

I'm trying to write a backup script that can be deployed on many different linux servers, some of which mount network drives as described in /etc/fstab. I want my script to be able to see if any network drives have come unmounted before a backup to…
1
vote
1 answer

"expect" in bash to input password

I'm trying to find a way to automatically enter a password when starting an SSH session. Is there a way to do that? I'm using openssh on Win10 to connect to my remote server. Thank you
1
vote
1 answer

Run PHP Script as a background process in AWS Beanstalk Post Install Hook

UDPATE It turns out that this is the wrong way to use elastic beanstalk. The app would be running, however it would be a hack rather than a correct solution. Use EC2 instead. I'm deploying a PHP application using following setup: Setup Bitbucket…
1
vote
2 answers

Changed my Server ssh_config and now Putty displays black screen with green box: What do I do?

My hosting service sent me this link to follow to prevent future brute force attacks on my VPS. I changed the port from 22 to 899, changed my deny file with sshd: ALL then added sshd : 11.22.33.44 in my allow file changing the address with my own…
user520726
  • 11
  • 2
1
vote
1 answer

script run through jenkins user gets killed

In our jenkins build configuration we have the following shell commands (Execute shell) as the last step of our build process. echo "$USER" echo "Script executed from: ${PWD}" git submodule update --init --recursive if [ -f composer.json ]; then …
user3360140
  • 281
  • 1
  • 4
  • 14
1
vote
2 answers

Set the environment variable for RHEL 7.3 for root user

I managed to set the environment variable for my user imin by editing the .bash_profile under folder /home/imin and added the path to my php 71 bin. Now when I run echo $PATH it shows the changes that I made, but now I need to do the same for my…
imin
  • 83
  • 11
1
vote
1 answer

Running a binary as a service in RedHat/CentOS

I have created a script to execute a binary as a service. But the service does not start the service but when i stop the service it shows multiple pids. I am using RHEL 7.Here is the complete details NAME="CentOS Linux" VERSION="7…
wandermonk
  • 103
  • 12
1
vote
1 answer

rsync: change_dir "/home/Sources//account@sub.inmotionhosting.com/home/account" failed: No such file or directory (2)

When run this command to make backup database file from remote server, I face the below reasult but I do not know what is the issue. The command I run on my local ubuntu server to git file from inmotionhosting.com rsync -h --progress --stats -r -tgo…
Ahmed Reda
  • 21
  • 2
  • 5
1
vote
1 answer

Bash function to ssh with command

I have simple script to check for uptime of bunch of hosts. But ssh command is taking 'uptime' command also as a hostname and throwing error after first iteration. while read line do echo "Turning off Monitoring for Host: $line" …
user518730
  • 11
  • 1
1
vote
3 answers

text processing linux using grep awk or anything else

I want to replace in this string Wed Apr 10 06:44:10 UTC 2019 all whitespaces with comma and along with that trim off UTC part. What I have tried : var1="Wed Apr 10 06:44:10 UTC 2019" echo ${var// /,} This gives all spaces removed but how to trim…
Alex
  • 172
  • 1
  • 1
  • 8
1
vote
2 answers

Add "sudo" to the last command line in bash

I run a command, then realize it should have been run with sudo. In zsh I have a function so that I can hit a ^x^x and it will grab the previous line from the history and prepend sudo to it, so I can run it again. Is it possible to do this with…
thermans
  • 247
  • 1
  • 2
  • 6
1
vote
1 answer

Long running bash update script loop. How to handle terminating better?

I have a bash script that downloads some data, runs a process to import it, then sleeps for a little while (about an hour). It's running fine as a systemd service (on Ubuntu 16.04 & 18.04) But I am afraid that interrupting the import process could…
Amandasaurus
  • 31,471
  • 65
  • 192
  • 253
1
vote
1 answer

Programatically change AllowOverride for

How can I progamatically (using BASH) change AllowOverride for from 'None' to 'All' ? Rather then having to manually edit /etc/apache2/sites-enabled/000-default Normally I could just use sed -i 's/AllowOverride…
BassKozz
  • 645
  • 2
  • 8
  • 15
1
vote
2 answers

Why am I getting sh: /dev/fd/63: Permission denied process substitution (anonymous pipe)

I have a shell script that adds users from a csv to a running nextcloud instance. The nextcloud instance is running inside docker containers. For some reason, I am getting an error from the line that is using process substitution <(anonymous pipe).…
quarterpi
  • 113
  • 1
  • 4
1
vote
1 answer

How to update the apt-check count of “X packages can be updated” message

Is there a command to update the apt-check results? I run upgrade and it shows 0 but apt-check still shows 12 packages can be updated. How often is this suppose to update on its own? I have numerous servers. Some seem to update instantly. Others go…
Kyle Anderson
  • 171
  • 1
  • 7