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

learn more… | top users | synonyms (1)

3
votes
1answer
89 views

Strange behaviour ssh -> bash --> (tty no echo) --> c program?

At job we have an old C program which works with industrial hand terminals from Honeywell. That terminal has its own ssh client to connect to a linux redhat 6.6 server. Once it is connected to the ...
2
votes
1answer
123 views

How to find out what what's creating temporary files

I notice a lot of empty files in /tmp with names similar to "/tmp/tmp.tMIHx17730". I run audit rule and I found out that mktemp is creating it which is not too helpful. How do I find out which script ...
2
votes
1answer
102 views

Echo each shell script command with a timestamp

set -x or set -v prints every executed command. How do I get the command printed with the time when the command started executing?
2
votes
1answer
132 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 ...
2
votes
1answer
469 views

Implementing and testing a Subversion hook

Background I'm trying to implement a number of commit hooks for Subversion. I have done a lot of research to try and get a simple test hook to work, however I have had no luck. For reference I have ...
2
votes
1answer
1k views

JBoss EAP 6.2 on RHEL 6: ./bin/init.d/jboss-as-standalone.sh hangs while calling via SSH

I'm using jboss-as-standalone.sh to manage JBoss EAP standalone as a service. I can start/stop the service with "service jboss-as-standalone.sh start/stop" while I'm on a terminal. But I would like ...
2
votes
1answer
282 views

init script terminating with ssh session

We need to run pt-stalk on a handful of servers to keep an eye on mySQL, and I was sick of manually starting it every time the server rebooted. A little googling turned up an init script for pt-stalk, ...
2
votes
1answer
98 views

Supervisord unable to shutdown fcgi processes

I've managed to set up supervisord with fastcgi on a django project of mine, the problem is that when I make mi program stop, the server keeps running somehow, and my page keeps online. Here is my ...
2
votes
1answer
108 views

IBMi bash upgrade

I am trying to install rvm in PASE on IBMi (v7.1) but it is failing because it states bash version 3.2.25 is required. Running bash --version via CALL QP2TERM states I am running the following ...
2
votes
1answer
1k views

Improper output in SSH session on OSX using FreeSSHd on Windows with cygwin bash/sh shell

I am testing out running an SSH server on a local Windows VM. I have installed FreeSSHd and set the command shell to "c:\cygwin\bin\sh --login -i" (bash as well) with "Use new console engine" ...
1
vote
1answer
39 views

systemd service shuts down on its own

I have a problem with this SystemD service: [Unit] Description=RTC Client Services After=rds.service Requires=rds.service [Service] User=USER Group=GROUP PermissionsStartOnly=true RuntimeDirectory=...
1
vote
1answer
34 views

xinetd read post data

I'm trying to write a simple handler for a webhook using xinetd and bash. I have the trivial case working with this config for xinetd: service github-hooks { port = 61000 ...
1
vote
1answer
25 views

Run command in screen when LSB initscript stopped

I'm trying to get a Bukkit server to run inside a screen as a service, started from an LSB script but I cant get it to stop correctly. What I essentially want it to do is reattach the screen and send ...
1
vote
1answer
48 views

How to get the output of the python script executed in aws instance

I am trying to automate the aws instance setup using boto. I have a python script in which I will do the ssh to the instance. After ssh,I am executing a python function which is in remote python file ...
1
vote
1answer
172 views

Difference between sudo /bin/bash and sudo su to access root

I am aware that there are at least 2 ways to escalate to root privileges when in the terminal, and am genuinely curious as to whether there is a differences / are differences as to what can be ...
1
vote
1answer
49 views

Cronjob to push MongoDB Backup via git

Task: Create a Cronjob that executes a bash script once every night. The bash script should do a mongoDB Backup and push it to a Git Repo. So I created a cronjob as the root user via the crontab -e ...
1
vote
1answer
144 views

Bash script working in command line but not through PHP

I'm attempting to run the following command through PHP: $output = shell_exec('sudo /Users/Derk/Code/automation/psc/pdfs.sh 1'); This runs the following bash script code: sudo /usr/local/bin/pdftk ...
1
vote
1answer
62 views

Python script crashes when run via Cron

I have a python script that completes exactly as expected when run manually as the root user. When I put the script into cron.daily it crashes 100% of the time. The error is a timeout error, but ...
1
vote
1answer
277 views

cron and lftp issue

I have the following scripts running on raspbian. start #!/bin/bash /root/config/commands 2>&1 > /root/log/$HOSTNAME.log commands #!/bin/bash source /root/config/variables echo TestLine ...
1
vote
1answer
436 views

How to start a tmux within bash right after reboot

I have created a script to run upon reboot of an Ubuntu instance. crontab -e Then added this to the script: @reboot /home/ubuntu/startup.sh This is how the script looks like: #!/bin/bash tmux ...
1
vote
1answer
99 views

Bash Script to set Linux OS

I'm working on a bash script and ran into an issue. I'm pushing what I know from using normal if/fi statements and trying to use them to set variables related to picking up the OS version, such as RH ...
1
vote
1answer
2k views

Nginx how to run shell script on page load via lua module os execute and then serve directory listing?

So I have a bash script that I want to execute/run on each "page load" of url so that it will modify (creating symlinks) to a /public/html/ folder that I want the server to then serve. The problem ...
1
vote
1answer
96 views

Is using su to drop root in shell scripts a security risk?

When searching for how to drop root permissions in shell scripts, I often see answers using su. However, when you're done using su you can just type logout and be back at the shell of the original ...
1
vote
1answer
718 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 ...
1
vote
1answer
81 views

SSH issues: keyfile and host file not working as expected

When I login to server with a key ssh -i /home/me/.ssh/id_rsa server everything goes without glitch. The key is authorized on the server. However if I try to do same from a shell script, I get a ...
1
vote
1answer
43 views

name of script within a init script

I have a script /etc/init.d/startup, where I do the following: creating a PID file that should look like: /var/run/**startup**.pid executing a screen of a java process, so I will like to create the ...
1
vote
1answer
297 views

lftp mirror leaves empty folders on remote

My script is set up with this for lftp lftp -p 2218 -u $login,$pass sftp://$host << EOF set mirror:use-pget-n 5 mirror -c -P5 --depth-first --Remove-source-files --log=/home/dog/...
1
vote
1answer
291 views

mailx command strange behaviour from cron

I have a script that redirect the df output to a file and then send it in an email. The mail command is set up as following: /usr/bin/mail -s "Subject" -r from@nowhere.com toaddress@somewhere.com <...
1
vote
1answer
145 views

crontab truncates file path

I try to run the following command: crontab -u root /root/iss/current/node/bin/installers/nl_brandless_selector_full_hd/nl_brandless_selector_full_hd_cron_file But I got an error like this: /root/...
1
vote
1answer
401 views

OSX - How can I copy a local users settings/preferences to a new mobile user

We are working on migrating all our local users to mobile accounts that are bound to LDAP. I am working on a script that prompts a user to enter their email and it creates a new mobile user and then ...
1
vote
1answer
306 views

Bash script for updating multiple servers not accepting RSA keys

In my environment I manage about 10 Linux servers that require regular package updates. I have a script written to connect to each individually and run the update. Additionally, I have RSA keys ...
1
vote
1answer
208 views

What is the Linux command to get the current PPTP ip address?

I have a Linux script that allows me to route some traffic through a VPN interface, and other traffic (from different IP) through another interface. This is my script: echo "ip route del default via ...
1
vote
1answer
84 views

cp/rsync command with destination as symlink to a directory

I am working on a cPanel backup solution at the moment. We are now informed about this exploit. Exploit : Full ROOT ACCESS to server 1.) create malicious file from, normal user account: mkdir root ...
1
vote
1answer
378 views

How can I measure the cumulative network usage of a process, from execution beginning to end

I want to measure how much bandwidth git pull uses, preferably by prefixing git command with desired program, i.e. nettally git pull Alternatively, is there some sneaky way to accumulate nethogs / ...
1
vote
1answer
274 views

nohup create multiple process

I am using nohup for the script run inotify command, because inotify stop when I exit from terminal so I want the script to run on background. so I run the script like this nohup /path/to/script.sh &...
1
vote
1answer
485 views

expect: how to use expect scripts from within a bash subroutine

I want to write a login script in expect. But I want this to be reused in different other scripts. I want to make all the login commands part of a bash subroutine. ie instead of expect_login.sh #!/...
1
vote
1answer
363 views

Using exclamation marks in bash expansion

In bash, I build a svn command as a string with username and password options dynamically added. Some users might have an exclamation mark in their password, which might result in the following: ...
1
vote
1answer
171 views

Remote rename of a file on Samba share via Bash script

I'm running a Bash script under Cygwin, but this question applies more broadly. I have a remote file: //someremoteserver/somefile.db That "//" path is under Cygwin--it's essentially a UNC pathname ...
1
vote
1answer
596 views

Autocompletion, history and scrolling in Byobu

I am using an Ubuntu server with Byobu. For some reason, the tab key writes a tab instead of completing commands and paths. Top arrow writes ^[[A instead of the command history. Scrolling writes ^[[B. ...
1
vote
1answer
216 views

Redhat 5 Upgrade / Sphinx Search Init Startup Hangs

I recently upgrade a VM to Redhat 5 and moved Sphinx Search to that server. For some reason when I try to start Sphinx, the startup script fails to push the searchd process to the background. I ...
1
vote
1answer
535 views

pbs/Torque interactive jobs: bash trick to run command after launch

I'm using pbs interactive jobs in bash, launched using qsub -I, and I'd like to run some command after launch. After this command is run, I'd like to continue to use the interactive reservation as ...
0
votes
1answer
9 views

No SQL result output from sql executed from bash

When executing an SQL from a shell like this, the sql result output isn't printed. How do I do it ? mysql -uroot -p < /root/queries.sql Edit: When the content of the sql is a SELECT, I do see ...
0
votes
1answer
58 views

bash script works correctly but skips commands in cron if I am not logged in via ssh or I was connected recently

I am trying to schedule some backup scripts in cron on a CentOS release 6.7 (Final). This is the full backup, basically mounts a remote directory, checks if there is enough space available for doing ...
0
votes
0answers
37 views

Terminal piping misunderestanding

Folks I have a few questions around this command: echo 'cat //item/*[local-name()="id"]/text()' | xmllint --shell test.xml | sed '1 d;$ d;/^ -------$/ d' | sort | uniq --repeated I thought command ...
0
votes
0answers
96 views

BASH: bash completion function in a custom script

How I can add existing function to a custom script? complete -F _known_hosts test.sh - this works on the command line however when I tried to add this to my custom script it's not working as expected....
0
votes
0answers
482 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 pi@...
0
votes
0answers
47 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 ...
0
votes
0answers
52 views

Ctrl-C is ignored by pppd when put in a shell script

I'm trying to connect to GPRS network through a serial port connected GSM modem. When I call /usr/sbin/pppd call <peer_name> from the command line, It correctly receives and handles Ctrl+C from ...
0
votes
0answers
106 views

SSH chroot solution for Mutt

We have an environment tailored for our users to log in via ssh and instead of gaining access directly to a shell, users have a script in place of a shell. The script simply launches Mutt on the user'...
-2
votes
0answers
20 views

How to deal with bash errors when trying to run it?

Imagine a script which has standard bash linux scripting (running on SUSE linux). Like this: #!/bin/bash #version=1.0 #Some other text command #-------Comment Changeversion=2.0 ... ... Is there ...