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

learn more… | top users | synonyms (1)

2
votes
1answer
88 views

Performing root mysql operations in bash scripts

What is a good practice to execute root operations on mysql databases in bash scripts? For example, I want to create new database and grant privileges, I have to use: mysql -u $ROOT -p"$ROOTPASS" -e ...
0
votes
1answer
58 views

Cronjob for a bash script pauses for 2 minutes randomly

I have been running a bash script on CEntOS 5.5 machine that checks replication on a remote mysql server. The script creates a temporary lock file and is scheduled to run in Crontab every minute. But ...
-1
votes
2answers
60 views

Getting Java Version in bash script results are blank [closed]

I've got a bash script that grabs a bunch of environment data, part of that grabs the JDK location on a Unix machine and then runs the version check. It works on some Machines but not others for some ...
0
votes
1answer
46 views

Timeout a script with stdin

I need something like this: timeout -k 4 cat file | myscript.sh but i get this error: timeout: invalid time interval ‘cat’ Try 'timeout --help' for more information. I want to pass stdin to ...
0
votes
2answers
74 views

Linux `file` command display encoding

The file command returns me the encoding of a file + the EOL if it's not LF. But it returns ASCII for both ANSI and UTF-8 without BOM. On UTF-8 files it returns UTF-8 Unicode (with BOM). An I doing ...
3
votes
1answer
205 views

Encrypting/Decrypting a file using openssl through an autorun script

So I am trying to encrypt/decrypt a file using openssl. I am running it through a script that is automatically run when I mount a USB, and decrypts the file. However, it doesn't work quite right, so ...
0
votes
1answer
119 views

Unable to redirect STDOUT in a remote screen session via SSH

I would like to execute a long-running command via SSH/screen and have the output redirected to a file. I'm able to run the command fine (similar to this question), but the output never shows up. ...
0
votes
1answer
184 views

insserv: warning: script 'uwsgi' missing LSB tags and overrides

This is my code: #!/bin/bash daemon="$APPVENV/bin/uwsgi" args="--emperor $APPCONF/uwsgi/app.ini" pid="$APPDIR/emperor.pid" case "\$1" in start) echo "Starting uwsgi" ...
0
votes
2answers
67 views

Purposely corrupt folder name?

I want to intentionally corrupt a folder name so I can test a script on it. Currently the folders are named similar to : 37ee0500-52c0-4a18-861e-0084EF05FB and are located in: /user/members/local/ ...
0
votes
3answers
88 views

how to run the dialog command with proccess

Please look on my code – ( bash script ) I want to display both dialogs on the screen on the same time, one dialog display the: tail –f from - /var/log/proccess1.log , and the second dialog ...
0
votes
0answers
61 views

Bash and background processes PGID and receiving signals

My actual problem is that a process I run in an rcfile in docker as docker run container bash --rcfile rcfile remains attached to the bash session by sharing the PGID which means that when I Ctrl-C an ...
-3
votes
1answer
60 views

use bash to open a file and output the last line [closed]

I'm trying to get only the last command ran in a different Bash window. I have the other Bash window's PID. I can run APID=<bash pid number>; gdb -batch --eval "attach $APID" --eval "call ...
0
votes
0answers
47 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
2answers
160 views

Which open source program is similar to the Linux “dialog” command? [closed]

The linux dialog command is a great tool for creating dialog boxes in terminal windows (e.g. in a bash script). However, there is a drawback of dialog which is that the window is always positioned in ...
3
votes
1answer
115 views

How to view two dialog boxes on the linux console, running on the same time?

I want to view on the Linux console two dialog windows on the same time. I want a window that views the progress BAR, and the a second tailbox that view the logs are running. The problem is that the ...
0
votes
1answer
21 views

Trouble using ssh-key gen specifying location and password

This is my code: ssh-keygen -t rsa -C "$APP" This works perfectly. However it then asks me to specify location and password. I was hoping I can automate this all in one go, however this command ...
0
votes
2answers
54 views

Generating random passwords with shell on server deployment

I'm trying to generate random and secure passwords to my various configuration files and settings on the fly when I run my automated deployment script. I want them to be generated, shown to the user, ...
0
votes
2answers
166 views

Bash: Execute command from variable without eval

I have a problem with a script which should execute a curl command composed from the given arguments. It works if I use eval in the subshell, however, I would like to avoid that as it seems to be bad ...
-1
votes
1answer
39 views

how can i redirect run program command on different server [closed]

I have 2 server Linux server (RHEL5). Server1 is running X server where users connect to it with VNC/NX and the other one is for running programs. So users don't interrupt to each other, I want to ...
0
votes
1answer
116 views

Background job terminates when run from script, but works fine when run from bash prompt

I'm on MacOS 10.9.4. I want to put sftp to background to automatically push some files to it through named pipe later, as suggested here. It works fine when I enter commands manually from bash prompt ...
0
votes
1answer
325 views

Will this HAProxy “restart script” work as gracefully I think it will?

I put this script together from various places. What I am hoping is that it will do the following once run: Pause all "NEW" http traffic for ports 80 and 443 - just "pause" them, don't give any ...
0
votes
1answer
46 views

init.d script appears to run but dies immediately

I registered the init.d script and when I invoke this directly /etc/init.d/gae it appears to work...PID file is created but the process is no where to be seen by the time I do a ps I have googled and ...
0
votes
4answers
178 views

Redirect HTTPS traffic without changing the HOSTS file

I have a website hosted on 2 servers. The website is SSL based. I'd like to monitor (load the main page and look for a certain string) the website per server using a local Opsview. Meaning I need to ...
0
votes
1answer
111 views

Bash time check script allow 1 minute difference

I am developing a nagios/collectd check for time checking on each server. I have done bash script to get info from Collectd WSP files and check them against the nagios server time (date +%s). Collectd ...
1
vote
1answer
990 views

ip route add works manually but throws “Error: an inet prefix is expected rather than …” when run via bash script

I'm trying to run a script that should add this route to a table 11: ip route add local 10.1.3.212 dev eth1 proto kernel scope host src 10.1.3.212 table 11 If I run this command manually, it is ...
1
vote
2answers
155 views

how to prevent git from using logged in username

I would like to make it possible for any user to clone a repository without having to specify the username in the clone command. For example, say my git username is john.doe (e.g. customer ...
1
vote
1answer
380 views

cURL - download multiple files and specify output names

I have list of URLs with range in {}. I can download them with cURL in bash, but problem is output. I can use #1, but I need to have files named with different names (I have stored those names in ...
-2
votes
2answers
194 views

Cron not launching python script

Python script is not being run, all other functions are running and stand alone script runs but combined... nada. Initially it was */30 * * * * screen python ~/db_preset.py (Yes there was new line ...
33
votes
8answers
5k views

How can I run arbitrarily complex command using sudo over ssh?

I have a system that I can only log in to under my username (myuser), but I need to run commands as other user (scriptuser). So far, I have come up with the following to run the commands I need: ssh ...
0
votes
2answers
73 views

Bash Script keeps respawning after it should die

#!/bin/bash PID=$(pidof daemon) kill $PID while ps -e | grep "[d]aemon" >> /dev/null; do sleep 30 done sh -c /root/daemon This script is set on a cronjob to kill and restart this program. It ...
0
votes
0answers
14 views

pipe rrd to a new directory

I am chrooted and running out of drive space, so I mounted back to the host drive which has plenty of space but cannot seem to pipe the outputted data to my empty drive [root@localhost rra]# ls ...
1
vote
1answer
43 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: ...
0
votes
0answers
29 views

different interactive and non-interactive shells

A user account has it's shell defined in passwd file as bash. I would like to change this user account's shell to tcsh for non-interactive jobs (like ssh ), but keep interactive shell to bash. Is ...
1
vote
2answers
235 views

Linux/Bash: Test if my server is opened to the Internet programmatically/via CLI [closed]

RHEL 6 and Bash. It would be easy if I had a remote server to just run nmap from, or even curl/wget, but I only have access to servers on our side of the firewall. I know I can manually check ...
0
votes
1answer
1k views

CentOS 6.5 proxy bypass/no_proxy not working

I am running CentOS 6.5 on my desktop. I've set the Network Proxy using the network proxy application provided under Preferences. I've also set the following exceptions: ...
0
votes
2answers
134 views

Run Bash Script Another Server

I want to run command one by one, for change the names of the directories on the server. When I run script, directories renamed in server 1. But, directories are not found in server 2. What the ...
-1
votes
3answers
213 views

Can't pipe echo to netcat?

I have the following command: echo 'HTTP/1.1 200 OK\r\n' | nc -l -p 8000 -c and when I curl localhost:8000 I am not seeing HTTP/1.1 200 .. being printed. I am on mac os x with netcat 0.7.1 Any ...
1
vote
2answers
291 views

Kill all currently running cron jobs

For some reason my cron job scripts aren't exiting cleanly and they're backing up my server. There are currently a couple hundred processes running for one of my users. I can use the following command ...
1
vote
2answers
96 views

script to count the occurence of the particular string in the given time interval

We are trying to write a script "sendemail.sh" to count the number of occurrence of a particular string in a log file "SendEmail.log" within the given interval. We have a log file. In that we are ...
-2
votes
1answer
367 views

Bash Script to Compress / Transfer / Remove Log Files [closed]

I am currently using chronolog to set log file names for Apache with date. They are in the following format: /WEB/LOGS/APACHE_ACCESS_YYYY-MM-DD.log /WEB/LOGS/APACHE_ERROR_YYYY-MM-DD.log I would ...
-2
votes
1answer
98 views

Ubuntu Server running Plesk subversion command only accessible to root user

I have a VPS through myhosting.com the VPS is running Ubuntu 12.04.5 LTS with Plesk 12.x when I log into my VPS with the root user and do svn help I get the standard reply telling me the basics of the ...
3
votes
2answers
230 views

Bash convert character in variable

I am writing a collectd nagios custom check script in bash. The problem I am having is that nagios shows hostnames as host.name.domain but collectd holds WSP files as host_name_domain. My question is ...
0
votes
2answers
42 views

Start reading a file's content from line N using BASH

Suppose I have the file temp.txt with the following content: 1 2 3 4 5 6 How would you read the file's content starting from line number 3 using BASH so that the output would be like this: 3 4 5 6 ...
2
votes
2answers
120 views

How to get dig +short to return something when there is no answer?

The behavior of dig +short is to return nothing (null) when running a query that returns no answer (nothing to do with timeout, just an empty answer). This is ok when running a query by itself, but ...
-2
votes
1answer
50 views

Make 'less' behave like 'tail -f' [duplicate]

tail -f does what it's meant to do pretty well, but it's rather limited when some more control is needed, i.e. when stopping/resuming text would be useful. Would it be possible to use less instead of ...
15
votes
5answers
2k views

Piping wget output to /dev/null in cron

I am running the following command every 5 minutes in my crontab to keep Phusion Passenger alive. */5 * * * * wget mysite.com > /dev/null 2>&1 When I run this it performs a wget on the ...
-2
votes
1answer
141 views

Is the Datadog install script safe to run? [closed]

I have a production server (CentOS 6, Apache, Nginx, MySQL, PHP, wordpress). I want to see some metrics (e.g., load bandwidth, RAM, CPU and so on). I chose a Datadog for this task. The instructions ...
2
votes
2answers
458 views

How to bypass sudo

I am trying to script a non-interactive install of Meteor (JS Framework) and part of the script prompts for sudo . I cant seem to get past it w/ my scripting skills. The install is : curl ...
3
votes
2answers
1k views

Can I use rsync to create a list of only changed files?

I am using rsync in a bash script to keep files in sync between a few servers and a NAS. One issue I have run into is trying to generate a list of the files that have changed from the during the ...
3
votes
1answer
50 views

In tar how can I exclude dir contents but leave empty dir

I want to create a tar file excluding certains folders who have many sub-folders and files, but leaving only the main folders that's being excluded. Explaining: -project |-dir1 |-dir2 |-cache ...