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

learn more… | top users | synonyms (1)

0
votes
1answer
14 views

Monit failed to start shell script

So I am having a problem with monit starting a process this is my code: check process program_1 matching "program_1" start program = "/home/user1/files/start.sh" stop program = ...
-4
votes
0answers
26 views

how do I make a script that counts down to Friday? [on hold]

echo $(($(date -d 28-Nov +%w) - $(date +%w))) days until Friday like above but instead it should count down every Friday
-3
votes
0answers
8 views

Bash Vulnerability in Solaris 9 [closed]

I wanna install patch for BASH Shellshock vulnerability on Solaris 9 server. Please let me know the process. I have already installed it on Linux bos but the process differs in Solaris I think. ...
3
votes
3answers
89 views

Setting up FQDN in sendmail [closed]

In this blog post he suggests echo '127.0.0.1 localhost EXAMPLE.my_domain localhost.localdomain EXAMPLE' >> /etc/hosts but ends the post with But this is a less desirable approach ...
-3
votes
1answer
25 views

Display only some of the lines of the lsof command [on hold]

I am trying to create a bash script for displaying only certain lines of the lsof command. I have figured out that the lsof command itself lists information in the form of columns which show info ...
0
votes
0answers
45 views

How to print a range of IP addresses with Linux seq command [migrated]

How can I print a range of ip addresses on linux command line using the "seq" command? For eg: I need seq to print a range of ip from 10.0.0.1 to 10.0.0.23 . Seems like the period in between the ...
-2
votes
1answer
32 views

How to open sftp connection and execute sftp command in the same shell command [closed]

Is there any possibility for opening sftp connection to remote server and execute sftp command in same line from shell. Something like this: sftp user@example.com && put /tmp/test.txt /tmp/ ...
-3
votes
1answer
31 views

How can I execute sibling scripts outside the directory? [closed]

$ ls -l bin/ $ ls bin/ startup.sh shutdown.sh I wrote a script named restart.sh inside the bin/ looks like #!/bin/sh sh ./shutdown.sh sh ./startup.sh Now the bin/ directory looks like this. $ ls ...
0
votes
2answers
18 views

Inserting multiple lines into a sqlite column with bash script

I am trying to insert a value into my sqlite DB that consists of multiple lines and special characters. For example: { "foo"="$BAR" } I have been using the sqlite3 command but I dont know how to ...
0
votes
1answer
24 views

Checking the history of www-data user [closed]

While normal users have a .bash_history in their home directory, the www-data user does not have a home directory. As such, are there any means to track the history of the www-data user?
2
votes
2answers
62 views

bc: using “scale” with bash variable [closed]

Easily, I'm writing a script that needs some values with 2 digits after floating point. Trying to use bc I don't understand how use "scale", i.e. A=12 ; bc <<< $(($A/5)) it's correct, but ...
-1
votes
1answer
20 views

Why does ssh -f create multiple processes when a pipe is used? [closed]

When I on my Linux host do ssh -f 10.10.47.47 "/opt/omni/bin/mbuffer -4 -v 0 -q -I 8024 | /usr/sbin/zfs receive tank/test" then I see on the remote host 27349 ? S 0:00 bash -c ...
0
votes
0answers
30 views

Script to restart service fails for most of the time

I have created a script that restarts a FTP service (a java program) if this value of below command is not zero: find /home/files_to_send -name "*.pdf" -cmin +10 | wc -l My problem is that while ...
-1
votes
1answer
26 views

Bash shell copy files on the hidden directory [closed]

Need help with Unix script. how do you use /bin/cp to copy files from /somepath/somedir/somewhere/.temp_folder to /somepath/somedir/somewhere/ my line /bin/cp -r somepath/somedir/somewhere/.[!.]* ...
0
votes
0answers
24 views

name of script within a init script

I'm trying to figure this out. i have /etc/init.d/startup inside the startup script I'm doing a few things: (or i will like to do) creating a PID file that should look like: /var/run/startup.pid ...
1
vote
1answer
67 views

Different bash path variables when using ssh script vs interactive ssh [closed]

I'm trying to run some ruby (bundler/rvm) commands via a script using Plink. I noticed that it was complaining about not knowing where some commands were. It seems as though my $PATH variable ...
0
votes
0answers
16 views

Barnyard2 error on start

Been setting up a snort box with barnyard2, run into the error below. Can someone please help? $Starting Snort Output Processor (barnyard2): ./barnyard2: 35: ./barnyard2: barnyard2: not found ...
-1
votes
2answers
29 views

set bash alias from bash script (not command line)

Differently from bash shell (for create new alias): alias test="echo test" if I do the same thing using a bash script, alias does not run: #!/bin/bash alias test="echo test" also export it, same ...
0
votes
1answer
46 views

Execute a service as a specific user under ubuntu

I'm running a gameserver and want to start it on a screen on system start, but screen is user specific, so I have to run the command as 'user'. So I wrote this short service script which starts itself ...
0
votes
0answers
29 views

What is a safe alternative to wildcards in /etc/sudoers?

In the /etc/sudoers file on my Red Hat server, I have this line: %webdevgroup ALL=NOPASSWD: /bin/chmod * /home/http/* This is clearly a bad idea, since someone could do something like this: sudo ...
-1
votes
0answers
20 views

Deleting lines with different patterns in a file [migrated]

I need to delete lines with different patterns, For example sed '/Paris/d' file.txt | cat -s sed '/London/d' file.txt | cat -s sed '/Rome/d' file.txt | cat -s sed '/Pais/d' file.txt | cat -s ...
-1
votes
1answer
95 views

Bash Script - Expect does not send password that ends with $!. Also need improvement to report connection timed out

Update: Password issue is fixed and connection timed out message was fixed too. Adding \ before $! worked. Example: *password\$! set passwds { *password\$! @tempP@ss %Test4%} For connection timed ...
1
vote
2answers
141 views

Expect script error send: Spawn id exp4 not open while executing

Update: Working code added here for others CREDITS to : http://serverfault.com/users/30957/glenn-jackman @Glenn I'm sorry! just apologizing and I mean it! Sorry Glenn your code need few changes ...
3
votes
3answers
51 views

How to pass command output as several arguments to another command

I have a command that produce a output like this: $./command1 word1 word2 word3 I want to pass this three words as arguments to another command like this: $ command2 word1 word2 word3 How to pass ...
0
votes
0answers
22 views

Usage of set -e in Bash [migrated]

In this script #!/bin/sh set -e exec svlogd ./main Do you know what set -e does? I searched man and Google without luck
0
votes
1answer
27 views

Mass disable customers in OTRS

The problem is about OTRS customers. I can't use an external customer backend, so I want to update the customer DB via CSV files. I already wrote a script to add new Customers via ...
0
votes
1answer
23 views

Send email on ldap creation

I have an LDAP server setup on a server running Debian 7 and I wanted to make it send out an email whenever a new user was created on that LDAP. I thought a cronjob would be best, but I have no idea ...
0
votes
0answers
54 views

Cron occasionally fails with “grandchild #X failed with exit status 3”

I have cron jobs and every now and then they fail. Just after log message that the command has started, there is grandchild #X failed with exit status 3 message. On the next run scripts finishes ...
0
votes
3answers
37 views

Modify config file settings from bash [closed]

I need to modify a config file from a bash script, changing the values of particular settings. I need to make the change using common Linux tools (sed/awk/tr/etc.). The config file can have ...
0
votes
1answer
57 views

How to grep a continuous stream, with paging

I posted this to Superuser but got no takers: http://superuser.com/questions/832578/how-to-grep-a-continuous-stream-with-paging I want to take a log file and filter out some irrelevant log entries, ...
0
votes
1answer
29 views

How to check the existence of multiple directories?

I have a script which obviously faulty: if [ -d "$BACKUP/${DATE_MAX}_"* ] then ... fi This script would only work if there is a single or no directory there at all. If there are multiple ...
2
votes
1answer
47 views

Apache - add http headers to requests, using script (bash, perl, php etc) to set the headers

I trying to work out the feasibility of a project where I want to be able to have a script run on every request (preferably filtered by mime type), and a script run to set the headers for the ...
1
vote
1answer
63 views

Why deployment sh script don't fails on failed nginx reloading?

I have sh script that restart nginx like the following: #!/bin/sh -e set -e error_exit() { d=$(date '+%D %T :: ') echo "$d Error: $*" >&2 exit 1 } if ! sudo service nginx ...
0
votes
1answer
22 views

NUT UPS: stop specific service on power failure

Does anybody know how to stop a service when there is a power failure using NUT? I made a custom script like this, the problem is that the script user (NUT) does not have root permissions to stop the ...
0
votes
1answer
29 views

Script that checks and runs a jar, sometimes runs it twice.

I jave written a small bash script to run every 10 minutes, check if a certain program is running and if not run it. However, I noticed that sometimes I have two instances of the same program running ...
0
votes
1answer
24 views

Script to copy auth keys to remote servers needs password four times

I work on multiple servers through ssh. I have automated the copying of ssh auth keys with the script below. The only problem is it asks for the remote servers password 4 times. How can I change ...
3
votes
2answers
78 views

Why is my find -type d performing fstat on every file in a folder?

I'm running find . -type d on a rather large directory tree. I am only interested in finding directories within this tree, but when I ran an strace against the process to make sure it was doing what I ...
0
votes
1answer
83 views

Updating a Vyatta 6.6 box for Shellshock

A client has a few Vyatta installations that they're eventually wanting to replace with VyOS. In the interim, they're running Vyatta 6.6 (last version prior to the sale to Brocade). It's an internal ...
0
votes
0answers
57 views

AD Authentication with SAMBA, Winbind and SSS

I'm having trouble authentication with AD to a SAMBA share on a linux server. Authentication appears to be working, but only halfway... [root@myserver ~]# wbinfo -a my_ad_user%password123 ...
0
votes
2answers
38 views

Using find to exclude a directory and tar up everything else in a directory

I have following in a directory: dir1 dir2 file1 file2 I want to tar up everything except dir1 When I do: find . -path '*dir1*' -prune -o -print I don't see dir1 in the output ( as expected) ...
3
votes
1answer
38 views

List directories not containing a file which has a variable prefix

I'm checking the output from a script. In some cases the script has failed, and a certain file hasn't been produced. I want to check whether this file is present in a directory and if not, print the ...
1
vote
2answers
36 views

Hourly Clamscan cron script failes at reading file list

I've this piece of code located in /etc/cron.hourly/hourlyclamscan. #!/usr/bin/bash # Create Hourly Cron Job With Clamscan # Directories to scan SCAN_DIR=/home/transmission/Downloads # Temporary ...
0
votes
0answers
28 views

Linux: Process ignores signals

Processes running in Linux ignores signals (INT,QUIT,TERM) except KILL. Programs such as top, tail -f, sleep and etc, do not respond when pressing Ctrl+C and thus have to stop them from another ...
4
votes
2answers
120 views

SSH Login Failure “-bash: error while loading shared libraries: requires glibc 2.5 or later dynamic linker”

I did a blunder on one of my production server and its very old RHEL 4 host. Due to recent "shellshock vulnerability" by mistake I upgraded the bash to wrong version from RHEL5 repo. Now I am ...
1
vote
1answer
41 views

Why does printf work differently with sudo?

I have a simple script to convert a text file with colour escape sequences to the actual characters. It works if I run it directly, but not with sudo. To set up the scripts: test.txt ...
-3
votes
1answer
53 views

Dump all DB with Bash Script in separate files [duplicate]

I would like to easily dump all my DB without typing same stuff many times ... (I'm a dev and I have a lot of DB on my local machine ) Any Simple scripts that comes to your mind ?
0
votes
1answer
56 views

SVN Post Commit Issue (Calling Bash)

All, I would like to invoke a bash script (to do some rsync magic) towards the end of my post-commit hook. Here is what my post commit hook looks like: #!/bin/bash REPOS="$1" REV="$2" ...
0
votes
1answer
79 views

Getting the passphrase to ssh-keygen

I have a new private key that I'm bringing to a docker container as part of a bash script. After copying the private key to /root/.ssh/id_rsa I wanted to regenerate the public with: ssh-keygen -yf ...
0
votes
2answers
33 views

Converting string into CLI instruction

I have a the following in a bash script: cmd="composer install" `"$cmd"` which results in: composer install: command not found However if I just run this in the same bash script instead: ...
1
vote
3answers
84 views

rsync using keygen login in bash script

So I have set up a password-less ssh login for a server. I can run rsync from the command line, and it works beautifully, and doesn't ask me for a password: rsync -avz -e ssh myDir ...