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

learn more… | top users | synonyms (1)

0
votes
1answer
10 views

Resolve packages not found and errors during configure,make,make install in a script

I need to have a script that will install a package from source in a Linux system and need to know how to take care of the errors that usually come up as a result of the first step ./configure maybe a ...
0
votes
1answer
22 views

Issue with Bash Script On FreeBSD

I have the below bash script set to run every hour via cron as the root user. The purpose of this script is to email us when files have been uploaded to our sftp server and send us the logins. Here is ...
0
votes
1answer
18 views

How to automate input for a repetitive script! Expect in Bash?

I am a junior sys admin. Reason I'm asking this question is because we don't have a senior sys-admin here who is proficient with scripting. Senior guys are at the head office and too busy for ...
1
vote
1answer
17 views

Find process with most TCP sockets?

How can I find the process with the most TCP sockets that is currently running with bash ? I would like to only output the process name
0
votes
0answers
11 views

Looking for a tool to check bash scripts [on hold]

I'm looking for a tool to integrate with Jenkins CI that will check our shell scripts. I found this tool https://github.com/koalaman/shellcheck. I haven't found any others and I'd like to have one ...
0
votes
1answer
41 views

Bash: Output of a command is written only to screen and not to another file while using tee, what could be the reason?

In order to troubleshoot some ftp connection error, I've been instructed to write a bash script which will infinitely connect to a remote frp server and get one file from there. ftpuser="ftpuser" ...
0
votes
0answers
24 views

Linux copy range of folders [migrated]

I found this link with an example of how i can actually copy range of files Copy a range of files in command line (ZSH/BASH), using this $cp P10802[75-83].JPG ~/Images/. Is there any way i can also ...
1
vote
2answers
48 views

Locally deny login to users authenticated via LDAP

I have a RedHat Linux server that are is use for more than 1000 users Users names are coming to the server via LDAP protocol, so login authentication is from the LDAP My question: is it possible to ...
2
votes
0answers
20 views

Linux: What could be the reason for random fails in updating passwd.byuid by running yppasswd?

In order to allow NOC users in my company to manage users through NIS I've created the following script: #!/bin/bash # This script will simplicate NIS user management. # You will not be able to ...
1
vote
1answer
24 views

Linux: How can I get a different exit code from the find command if no files matching the pattern I used are found?

I have a script which runs the next command: find /storage2/hpfiles_staging/ -name \*.gz -mmin +600 And then rsync's the files to a remote location. Sometimes the find command returns no output ...
-1
votes
0answers
11 views

Syntax error on simple init script for debian [migrated]

I have this init script to run uwsgi. It works, but only on the start command. All the other commands give me this error: /etc/init.d/uwsgi: 27: /etc/init.d/uwsgi: Syntax error: ";;" unexpected It ...
0
votes
1answer
14 views

issue with xinetd arguments

i have created this BASH script called blah which does something simple like this (See below) #./blah -x "bindas" hello bindas i would like to execute script using xinetd with dynamic variable, ...
0
votes
0answers
12 views

Init script only offers help suggestion

I modified the uwsgi init.d script for debian from the apt-get package download. This is the script I have below: #!/bin/sh ### BEGIN INIT INFO # Provides: uwsgi # Required-Start: ...
-2
votes
0answers
26 views

awk parsing output and extracting values [closed]

I am sorry to bother all good people. Unfortunately, I am no good with awk and under a past-due deadline. I suspect that my question is simple for the right person. Perhaps, I am wrong. Some program ...
0
votes
0answers
28 views

bash $(printf “%s\n”) does not create multiline [migrated]

I created shell script, that logs into FTP server and renames some directories. I put FTP commands in multiline string like so # !/bin/sh ftp -inv $HOST << EOF user $USER $PASSWORD $COMMANDS ...
1
vote
0answers
19 views

Git Pull on CGI and Command Line have different results

I have an "after push" webhook on GitHub that calls a CGI script to update a Jekyll website. The script: user@server [~/_repo]# cat cgi-bin/githook.cgi #!/bin/bash echo Content-type: text/plain echo ...
0
votes
0answers
25 views

How to package shell script file with license key file

I am working on automated shell script for specific task . Before executing task steps I want to validate the license key provided to the customer with a webservice call. Please help me in making ...
1
vote
0answers
58 views

Powershell execute Queries using SQLPLUS

I have a RHEL server with Oracle 10G installed. I need to write a powershell script to query my database and get the output. I have imported Posh-SSH module and am able to connect to my RHEL server ...
0
votes
1answer
35 views

How to use environment variable in haproxy?

I work with haproxy 1.5.2 My haproxy.cfg has this server definitions: server HALB_ucd1 ${UCD1_END_POINT_IP}:${UCD1_END_POINT_PORT} check port 8444 I set the UCD1_END_POINT_IP and ...
0
votes
1answer
25 views

catch bash script output from expect, expect hangs

I currently use expect to pass password to rsync to copy files across unix servers test.sh ./expect.sh $password rsync -azvr $username@$host:$file ./$dir expect.sh #!/usr/bin/expect -f ...
-3
votes
0answers
17 views

Maunually executing a CRON - Confused about params [migrated]

I have this code snippet: $CUSER=tim $APPDIR=/var/www/testing $APPVENV=/var/www/testing/ven cat > $APPDIR/cronfile << EOF PWD=$APPDIR/$CUSER PATH=$APPVENV/bin:\$PATH 0 2 * * * testapp search ...
2
votes
2answers
43 views

Manipulate JSON in bash

I have a JSON file I need to update a particular value. { "Comment": "comment", "test": { "enabled": true }, "enabled": true, "otherStuff": blah, "otherStuff2": blah, "otherStuff3": ...
0
votes
0answers
34 views

CentOS - how to chroot sftp and have mysql as shell

I have a user who I would like to have sftp access to one folder only (chrooted). Also he logs in with ssh, I would like him to only have access to mysql. I am able to chroot the users sftp (by ...
0
votes
1answer
39 views

Command fails during script execution in bash

I'm working on a bash script for automatize some common tasks but I'm having some issues and I need some help. This is the script I'm talking about: #!/usr/bin/env bash PS3='Please enter your ...
0
votes
0answers
56 views

Executing a remote command over an SSH tunnel

I have created a reverse SSH tunnel from computerB to computerA. On computerA I have a script (r1on.sh) with the following content: #!/bin/bash echo 'r1on' > command.log /usr/bin/ssh -p2222 ...
0
votes
1answer
15 views

lvm clone logical volumes layout to another host

I want to clone LVM logical volume layout to another host ( = Create volumes with same size ). Does anyone know solution for this ? I know I can execute something like: sudo LC_ALL=C lvs -o ...
0
votes
0answers
34 views

Keep execution of bash script when aborted via CTRL+X or CTRL+C [migrated]

This is very nooby question I belive and I've tried everything to avoid asking it here, but I didn't found answere anywhere on whole internet. Go on and give me downvote but please answer me how to ...
8
votes
1answer
676 views

reboot multiple machines remotely

I need to reboot a number of machines remotely. Normally I just issue for host in <hostlist>;do ssh ${host} 'sudo shutdown -r now';done But I want give the users some time before the ...
0
votes
1answer
31 views

Can't seem to create file in bash

I'm trying to use this (under the root account) code in debian 7. #!/bin/bash cat > /root/.ssh/github.id_rsa << EOF -----BEGIN RSA PRIVATE KEY----- XYZ... -----END RSA PRIVATE KEY----- EOF ...
0
votes
2answers
29 views

Remove duplicate lines in file that doesn't appear in sequence

The uniq tool isn't a good fit because it only works on duplicate lines that appear right after the previous ones i.e. in sequence. Instead, I want something that turns a textfile dupl.txt. Also, I ...
4
votes
0answers
64 views

How to securely quote an optional flag? [migrated]

If $FOO is set, I want to run: cd "$OUTPUTDIR" && fpm -s dir -t rpm \ -a x86_64 \ --epoch "${PKGEPOCH}" \ -n "${PACKAGENAME}" \ --version "${PKGVERSION}" \ --iteration ...
0
votes
3answers
64 views

How can a script loop for 30 days?

I have a script, backup.sh, that creates a backup of a MySQL database and then SCPs it to a remote server. This works great, and I can run this once per day using crontab with no problems. However, ...
-2
votes
1answer
50 views

How do I install lvextend on CentOS?

lvextend did not come installed on my CentOS image, how do I install it? # lvextend -bash: lvextend: command not found
-3
votes
1answer
57 views

Are these Advanced Features possible with a Bash Script on an Ubuntu Server? [closed]

I am trying to build a really flexible and useful Server Backup Bash Script. I have pretty much no experience working or building Bash scripts. I know that thousands of them exist in the wild but I ...
0
votes
2answers
30 views

Creating a log file inside a script works when manually run, but not when run through cron

I'm using Percona's Xtrabackup tools to back up a database nightly. I wrote a wrapper script to keep the proper number of backups around, write the output to a log file, and email the log file if the ...
0
votes
0answers
16 views

How to (best) configure updatedb in cygwin to search windows shares?

Context: Finding Files Quickly Across the Network A confession. I'm more of a bash/linux developer type than a windows admin. Our deployments have over 80 servers. Recently a software bug required ...
0
votes
0answers
13 views

vim - “Press ENTER or type command to continue” right after loading only? [migrated]

Recently my vim has developed the habit of displaying Press ENTER or type command to continue the first time I do certain things right after I open it. For example, if I'm at my shell prompt and type ...
-3
votes
1answer
42 views

bash script mysql reset pass

It seems that this code is not working I tried using it on my debian 7 machine and the password it gives me is wrong. # Please confirm that you want to reset the MySQL passwords CONFIRM="n" echo -n ...
0
votes
1answer
26 views

rsync not behaving the same in script vs shell

Afternoon ServerFault, I have hit a problem that I can seem to reach a solution to, I currently have a backup script that is meant to rsync VMs off our VMWare box onto our backup server, the problem ...
1
vote
0answers
46 views

How to make Supervisord read bash environment variables [closed]

I am using Supervisord to run my java application, which requires some environment variables for configuration. I am setting the environment variables in /etc/environment export ...
0
votes
1answer
22 views

How to act upon condition of whether a file updated via Rsync was updated

I think this is simple but I can't find anything in my googling, maybe I'm searching the wrong terms. I have a machine that syncs itself to another machine. If there are changes to a file on the ...
0
votes
0answers
39 views

How to read/ modify freetds.conf (for ODBC) using augtool or similar in bash script?

How can I get augtool (augeas) or a similarly common tool to work with freetds.conf, so I can automate some configuration in a bash install script? This doesn't seem to work: augtool print ...
0
votes
1answer
50 views

sudo: unable to execute … bad address - what is it and how to fix it?

I have a set of scripts which finishes up client machine deployment after executing a fairly generic NetRestore image. The main script runs under root privileges, and then calls another, "user" ...
0
votes
3answers
91 views

postfix/dovecot - run script when mail is received

I need to implement solution on my postfix/dovecot server which will execute bash script every time message arrives. For this purpose I did following things in master.cf configuration myhook ...
0
votes
0answers
34 views

Is rbash secure if user login and ssh passwords are disabled?

I've got a server that I want to use as an SSH gateway for remote and local port forwarding. I don't want arbitrary commands to be able to be executed on it, only my scripts. I keep reading about how ...
0
votes
0answers
37 views

Nagios plugin quits when encountering the bc command— how to diagnose?

I've written a nagios plugin using the bash scripting language. When I run this script by hand it works with no issue. Putting it into a nagios plugin however, using the same parameters, leads to ...
2
votes
1answer
48 views

How to exit after starting a service in Linux for loop

I have a for loop I'm using to stop and start number of development servers here is an example. for i in `cat hosts` ; do ssh $i -i .ssh/key.key -t sudo /etc/init.d/jboss-as start ; done This will ...
0
votes
1answer
46 views

Catch all emails and pipe them all to a script with postfix

I realize this question was asked and answer before. Here's what I have done. Created a catchall address and user. Here is my /etc/postfix/virtual file. @example.com catchall Added it to main.cf. ...
1
vote
1answer
25 views

Environment variable not available in python

I have a pretty interesting problem regarding environment variables, and googling around didn't show me any meaningful results: $ echo $BUCKET && python -c "import os; print ...
-3
votes
1answer
79 views

Looking For Simple, Fast Incremental Backup Algorithm Using RSYNC [closed]

I'm running a simple bash script that uses rsync to do an incremental backup of my web server every hour. What I'm looking for is an efficient algorithm to delete the proper backups so that in the end ...