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

learn more… | top users | synonyms (1)

1
vote
1answer
113 views

Shell script error on filename with spaces

I have a bash script that search for every static file located under my server root and stores a gzipped version next to each file. I got it from ...
4
votes
3answers
248 views

Pipe stderr and stdout to different commands (not just to files)

I'm making a backup script for ldap. I want the errors to go to a file in /var/log and the output to go to another file in the backup folder. Currently I'm redirecting to a temp file and then sending ...
1
vote
2answers
284 views

Capture Output of Python script in a bash script

I have a script that monitors game servers. It is written in bash. However I am attempting to put together an advanced monitor to pick up if the server has locked up. This requires a small python ...
0
votes
2answers
117 views

.bash_profile isn't sourced during logon

I've declared an alias in .bashrc file located in my home directory. Export of PS1 environment variable has been added to this file too. # /etc/skel/.bashrc # # This file is sourced by all ...
2
votes
2answers
350 views

How to grab either bash history or last x number lines from shell process running on other tty

interesting little dilemma. This is Centos. Last night I logged into the physical console on a tty. I launched a command and let it run overnight. The tty is still logged in, but I am currently logged ...
1
vote
1answer
268 views

Amazon CloudFormation - is there an elegant shutdown and delete instances?

I have recently been recently using Amazon's CloudFormation to launch instances of EC2 Ubuntu machines running MongoDB. When it comes to deleting the stack it often fails I guess due to not being ...
-1
votes
2answers
43 views

any native disk utilization command without need to install

is there any simple bash command to show current disk read/write usage without installing anything on the machine ? please note it's not to test the hdd read/write speed, it's to know the current ...
1
vote
2answers
1k views

Capistrano error “bundle: not found”

I'm trying to deploy octopress on a VPS but getting this error bundle: not found but bundle is installed! Full error. $ cap deploy * 2013-07-20 18:08:55 executing `deploy' * 2013-07-20 18:08:55 ...
0
votes
0answers
38 views

bash redirections stalling when used with jstack

I have this command that is not working and I have no idea how to debug. The command it never returns and I have to press CTRL+C. diff <(jstack 13928) <(sleep 10;jstack 13928) I want to make ...
3
votes
4answers
254 views

Bash one-liner that shows a running countdown until a DNS update (TTL expiration)

I find myself frequently tasked with updating DNS records and needing to know exactly when the refresh will begin (a.k.a TTL expiration). I came up with this bash one-liner that gives me the output I ...
-1
votes
1answer
234 views

SSH reverse tunnel through middleman server - how to connect in one step?

My question is basically how to turn my existing two steps into one step. I have a working SSH tunnel set up between two computers using a middleman server like this: ...
0
votes
3answers
163 views

List all php files inside a folder with modification date and permissions

I did write a script which checks all php files within a given folder for changes every hour, so I can detect possible code injections and their integrity. It's working so far, but my approach seems a ...
1
vote
1answer
53 views

Cronjobs putting archive in wrong directory

I am running a website on an Amazon ec2 instance running the default Debian linux. I set up a cronjob to copy the site files, take a database imprint, and zip them up. I want to keep the file ...
0
votes
0answers
74 views

Get an OpenVZ container's cpuload realtime in a bash script

I have a bash script which uses CPU cores rather intensively. Recently my VPS was suspended due to server load. The main reason is a cron job for a bash script which checks for Wordpress plugins and ...
-2
votes
2answers
128 views

Create a new folder using bash without mkdir command

i'm creating a small shell script, and i want to know if is there a builtin command to create a new folder without using the mkdir command. I googled it but i wasn't able to find a way to do that. I ...
0
votes
1answer
63 views

How to use a common library of environment variables among different languages?

We have three main languages with which we perform system tasks: Bash, Ruby, and PHP, and Perl. Four, four main languages. We use managed environment variables to provide authorization info that ...
2
votes
1answer
72 views

Hold till last command completes its execution

I am developing a shell script which actually stops aws running instances in a particular region & start them again as a part of schedule maintenance. but as ec2-api tools are heavy, takes time to ...
-1
votes
2answers
620 views

Shell script :: Reading a column from file & store it in array [closed]

I am working on shell script where i want to store O/P of the command in array. I have a file containing rows & columns from where i want to extract 3rd column & store all values in a array. ...
1
vote
0answers
77 views

Trying to script rsync using pam_exec

I'm trying to write a bash script that will execute rsync when called by pam_exec. I've tried a couple different ways, and I'm not sure what I'm doing wrong. When I try to run the script at login by ...
4
votes
3answers
864 views

Run a local script on a remote server using ssh with out having to worry about quotes

So I have been running local scripts fine on a remote server: ssh user@server "`cat local-script.sh`" However, today I have a script that has both single and double quotes in it. Which causes the ...
1
vote
5answers
102 views

linux how to tell the process for a script?

I ran a script postData.sh, but when I do "ps -ef", I don't see the script in the list of programs running but I do see extra -bash processes running. How do I determine the pid so I can kill the ...
0
votes
1answer
29 views

Why is Cat quoting individual words in command substitution

All, I'm attempting to use command substitution to keep command line arguments in a file. My initial thought was to simply place the command line arguments in a single line in a file and then call ...
2
votes
3answers
98 views

how to get [ current_path ] in shell bash prompt?

Is it possible to have the name of the current working directory in the prompt in shell ? Im working on OSX and CentOS in multiple projects under /srv/... and a mistake for wrong directory is quickly ...
0
votes
4answers
91 views

How to know if copying directory is complete

If someone (i.e. my VPS provider), does the following command, how can I from my ssh know if the copy is complete? Thanks cp /home/abc/hugeDir /home/cba
1
vote
1answer
161 views

losing line endings using Linux mail sending email to Windows Outlook

I am losing line endings when sending an email from Linux to Windows using 'mail'. I have tried all ways of doing this, setting the multiline 'body' text as a variable and then piping this into mail, ...
1
vote
2answers
287 views

Bash: Call shell script but do not wait for return code

Is it possible in Bash to call a shell script from another shell script but not have the original script wait for the sub-script to complete?
0
votes
1answer
174 views

Nagios: bash is missing

I'm monitoring NTP server with nagios and nrpe, at the nagios server, when I get the following error: Service Status UNKNOWN Status information I am missing an important component : bash The plugin ...
-1
votes
2answers
629 views

how do I install pdsh on centos 6? [closed]

I'm following a tutorial on how to configure a centos machine to be a node in a hadoop cluster for HortonWorks. I'm doing this on a virtual machine on VirtualBox. Sadly, since I am a linux beginner, ...
-1
votes
2answers
143 views

Cannot source .bashrc over SSH

Logging into my work station over SSH, I notice that none of my aliases work. Sure enough: $ alias $ source ~/.bashrc Could not open a connection to your authentication agent. So I googled the ...
0
votes
1answer
98 views

Export environment variable to login shell

I'm using bash in Debian. When I export a variable to the environment of my sub-shells it works: aUser> EXPORTED=exported aUser> export EXPORTED aUser> su myUser myUser> echo $EXPORTED # ...
2
votes
1answer
99 views

How do I find the biggest files on multiple servers and sum up their size?

I am trying to find the biggest files in the /export/home directory and add up (sum) their sizes. Script: #!/bin/bash filename=hostnames > export_home.log while read -r -a line do ...
0
votes
1answer
123 views

Limit TOP to specific processes (without static PIDs)

I would like to monitor specific processes via TOP on our application servers via TOP. Currently, I have been using the following in BASH to monitor just the processes that I am interested in: top -p ...
3
votes
2answers
1k views

how to filer rsyslog messages by tags

I have several applications and scripts that I want to redirect the output to custom files. I launch those applications using command | logger -t TAG I would like to filter these messages based ...
2
votes
2answers
82 views

Are passwords sent via a bash script retrievable?

As part of running a backup script for a linux server, I have commands like mysqldump within a bash script which contain the mysql root password, and certain ftp server passwords. Are these ...
3
votes
3answers
453 views

How to search the entire system (Linux) for a particular string?

I need to find this string: 7z a -p I've tried: grep -iR "7z a -p" / But it seems to hang after a while, with lots of: grep: /sys/class/vc/vcs5/power/autosuspend_delay_ms: Input/output error ...
1
vote
3answers
154 views

“while read line” returns early when calling ssh “mysql…”

I have a script that reads in data from mysql (the get_sql_results function below) I then read in each line, parsing individual columns with awk. Everything works fine except for the line that assigns ...
0
votes
2answers
214 views

Strip out the 'n' \ new line out of the echo to a file [closed]

I have a bash script that pulls a bit of text from an external MySQL database. Most of the times it are 4 lines, each one on his own line. This text (in total) has to be placed into a file. The script ...
1
vote
1answer
77 views

nice command - are other commands executed with script also niced?

A quick question about how nice works. Say if I have a script that runs in the crontab like so 0 4 * * * nice -n 19 /usr/local/admin/script.pl It is set to the lowest priority. This script will ...
6
votes
3answers
1k views

Possible to disable “You have new mail in /var/mail/root”?

I would like to disable the mailcheck in FreeBSD 9.1. My login shell is BASH, so I have tried to add unset MAILCHECK in /root/.bashrc and /root/.profile, but I still get those messages. Question ...
0
votes
2answers
59 views

Quitting Screens With Same Name With SSH [duplicate]

I have a server, with a few screens started. This is what shows when I use screen -ls: There are screens on: 12811.screen (Detached) 2061.screen (Detached) 7055.screen (Detached) ...
0
votes
2answers
466 views

Linux bash: run script as a non-root user by a non-root user using PHP

I have a PHP script owned by "tom" (runs using PHP-FPM). "tom" wants to run the script /srv/helloworld.sh as another user called "jerry". "tom" has the access to run scripts on the server (so he can ...
1
vote
1answer
141 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: ...
3
votes
2answers
195 views

How do I properly escape and interpolate variables in Bash?

I'm trying to write a one-liner to convert html entities present in some files (all html with UTF-8 encoding) I've tried recode HTML_4.0 file.htm but that also converts non-ASCII characters (it ...
1
vote
2answers
99 views

Close/Quit All Screens with SSH

I have a lot of screens on my server. With screen -ls I get: There are screens on: 12858.test1 (Detached) 28210.test2 (Detached) 12494.moretesting3 (Detached) 31787.testingfour4 ...
2
votes
1answer
317 views

rsync certain files, excluding the rest, ignoring .svn/ directory, recursively

I'm using rsync to copy some files from a share to another. Recursively, I need to: Delete files at destination that were removed from the origin Only sync php and js files Exclude every other file ...
-1
votes
1answer
116 views

Determine which process owns an flock'ed file

I have a Bash script that runs in multiple processess concurrently. The relevant portion looks like this: flock /var/lock/my_lock my_command Given that /var/lock/my_lock exists, is there a way to ...
2
votes
1answer
884 views

Linux- Permission denied?

I'm installing Neo4j server as a linux service, but when I install it, I get the following message: /sbin/insserv: Permission denied What is this? What should I do? I'm running everything with ...
1
vote
2answers
62 views

How to “unlocalize” bash script output

I have a problem with localized bash output. Say, I have to run some script on two different machines and then compare its output. It could of be done with grep easily, but one of the machines is ...
0
votes
2answers
58 views

Bash files with Github [closed]

I've never saved any of my bash scripts with an extension and I've just recently pushed a bash script to Github and realized that it's not properly highlighting the correct syntax such as: comments, ...
3
votes
1answer
429 views

How to detect, in the guest operating system, if the vmware tools are out of date?

I'm trying to find a generic way of checking, in the guest operating system of a virtual machine, if the VMware Tools are out of date. The best way I have found so far has been to check the output of ...