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

learn more… | top users | synonyms (1)

0
votes
1answer
128 views

Unable to get cron to append output from wget

I have a cronjob setup and running, but the logfile keeps getting overwritten every time it runs. I would like for the wget output to be appended each time the cron runs. Why is this and how do I fix ...
1
vote
1answer
131 views

Change PS1 value for all Bash users

I am trying to change the prompt value for all users of a system (the $PS1 variable) to the same value. I have the following stored in file /etc/ps1: PS1='` if [ $? -eq 0 ]; then echo -n ...
-1
votes
2answers
64 views

Way to aggregate large influxes of email [closed]

we are setting up a monitoring solution that'll utilize email notifications. However we have already seen that there are instances in which certain problems will affect large clusters of nodes ...
0
votes
4answers
515 views

How to make bash script executable for a user, but not readable

I'm trying to run a script at login that will execute for a regular user, but not be readable by that or other non-root users. I've tried various things including chmod/chown combinations, as well as ...
1
vote
2answers
576 views

How can I make ssh wait until the command exits? [closed]

I have a script that looks like this: SERVER="RHT372 RHTl373 RHT374 RHTl375" case $1 in "stop") for SERVER in $SERVER do echo "================================================" echo ...
0
votes
0answers
38 views

Include executed cron command when outputting to log

Is there a way I can include the command in the output when I'm logging to a file? For example * * * * * date && /path/to/php /path/to/script.php >> cron.log 2>&1 Would give ...
0
votes
2answers
66 views

Copy files from path to path same structure for each user

How to copy files from source /backup/cpbackup/daily/a1/public_html/index.html /backup/cpbackup/daily/b2/public_html/index.html /backup/cpbackup/daily/c3/public_html/index.html ...
2
votes
1answer
106 views

script migration from CentOs to Debian - error message “[: 10: -lt: unexpected operator”

As I was trying to execute a script in a new environment, I came up with this error: [: 10: -lt: unexpected operator Here is the painful part of the script: end=$((SECONDS+60)) while [ $SECONDS ...
-1
votes
3answers
126 views

How to replace a certain path from the PATH variable? [closed]

I am using Cygwin and would like to modify the following PATH via bash shell: /usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VSTSDB/Deploy:/cygdrive/c/Program ...
1
vote
0answers
610 views

Can't write to other users “you have write permission turned off”

For some reason I'm not able to write to other users on my system. [root@hostname ~]# write write: you have write permission turned off. [root@hostname ~]# mesg y [root@hostname ~]# mesg is y ...
-1
votes
2answers
116 views

Monitor port status in Linux [closed]

I want to monitor the list of used ports in linux system. I want to make a script that can run an alert when a new port is up or down. For example when the port 8080 is up , i get an alert: this port ...
0
votes
2answers
100 views

What seems wrong with this bash script? [closed]

I found an initscript that for some reason insists on starting the specified application as the root user. I can't wrap my head around why it is doing this, any hints? The script runs on Redhat ...
0
votes
1answer
34 views

Is there a tool for indexing a directory in order to perform cheap content search? (hashing by word, for example)

I am often using grep -R on an entire directory tree to find all files that contains a specified word. I wonder if there is a tool that makes the whole operation much faster, maybe via hashing? (Unix ...
0
votes
0answers
39 views

How can I detect if I have access for resource?

I'm trying to write bash script for file copying from local machine to FTP using lftp. Problem is, when someone enter inaccessible path for mkdir or put, then LFTP returns e.g.: Access failed: 550 ...
1
vote
3answers
112 views

Dynamic logic in environment variable?

I regularly invoke a particular remote server from a (Linux/bash) command line via tools like cURL or wget. This server requires an authentication token that expires every 10 minutes. I have a program ...
0
votes
1answer
121 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 ...
11
votes
1answer
340 views

Can Bash Tell Me Which SSH Public Key Was Used To Authenticate?

Let's say I want to track my root users. Each of them has a unique private key and their public keys have been stored in /root/.ssh/authorized_keys. Given that each user logs in with their unique key ...
2
votes
1answer
338 views

What is the format of mtr raw output?

I use mtr to count number of hops to a host and pass that number to a script. I discovered -l (or --raw) option which produces an output ready for parsing. However, I'd like to know where to find this ...
0
votes
2answers
39 views

Getting the executed source from bash

Okay, this is a last attempt to see if I can salvage something I accidentally did. I accidentally did "command > ~/.profile" instead of "command >> ~/.profile" on my computer. I didn't have it ...
1
vote
2answers
192 views

Strange characters from output in shell

Over the past few years there have been some Linux systems that will output strange characters when running various commands. Here's an example of my output from the sensors command on one of those ...
0
votes
3answers
273 views

Running svnsync on a repository with group suid/sgid set fails to execute a hook

I have a Linux server that I am attempting to run svnsync against a list of repositories to mirror / back up. I created a folder /srv/backups and set it to have the group gsid of adm, using chmod g+s ...
1
vote
0answers
68 views

use socat to provide password to bsign

I have many servers, where I deploy various binaries. For this purpose I use a script that packs them into archives, publishes to the local repository and then ssh-es to the target servers and ...
0
votes
1answer
310 views

cron.hourly script executing multiple times

The setup I have a script /etc/cron.hourly/msm-hourly that contains this: #!/bin/sh LOGPATH='/opt/msm/servers/cronscripts' LOGFILE="$LOGPATH/msm-start.log" # Make restart dead servers echo "" ...
1
vote
0answers
93 views

error in killing tshark from shell script

I'm getting this error "* glibc detected * /usr/sbin/tshark: double free or corruption " while doing this, any idea why? #!/bin/bash trap 'my_exit; exit' SIGINT SIGQUIT count=0 /usr/sbin/tshark -i ...
0
votes
0answers
209 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 ...
0
votes
1answer
3k views

Limit tcpdump capture files by time and size

I am having some problems getting tcpdump to log all internet traffic on an interface with the following limitations: I would like a new pcap file every hour with time and date tag in the name If ...
0
votes
2answers
51 views

Automatic VM disk resize

I got a KVM/Qemu setup that works great. Now I want to streamline the provisioning of new VMs. The two obvious ways are to either clone an existing disk or install from scratch (with an automated ...
1
vote
5answers
204 views

How to remove a file where the file name has utf-8 character issues

I want to remove a file from a server via bash rm command. This is a sample file Test_ Mürz.jgp. How would one go about removeing files with such chars issues in the filename on a grand scale ... ...
0
votes
1answer
117 views

Git installation for a newer version fails on ./configure

I'm trying to upgrade my Git version to 1.8.3 on my fresh new CentOS 6.4 server(Cloud). I'm trying these instructions here because I will then install the Gitlab. I have used this document before ...
4
votes
2answers
164 views

Preventing bash tab completion of an environment variable with a FS path value from removing the environment variable name

Friends, I am using GNU bash as my shell on Linux: $ bash --version GNU bash, version 4.2.45(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU ...
2
votes
0answers
136 views

Continuous ping on proxy preventing https requests, why?

I hope someone can help me solve this mystery. I have a small linux box which is configured as a transparent proxy on my network. I'm trying to run a script at startup that does a continuous ping to ...
1
vote
1answer
197 views

Tmux and encryptfs causing “(unreachable)” directories upon reconnect

I'm running an Ubuntu 13.04 server with an encrypted home directory (encryptfs). I keep a tmux session open which holds my development environment (vim, etc). When I disconnect, I'll detach the tmux ...
2
votes
2answers
355 views

Add time stamp to script log entries

Currently I have my bash script using exec 22>&2 21>&1 1>$log 2>&1 to write stderr and stdout to a log file. I would like to add a time stamp for each entry, but I haven't ...
2
votes
2answers
631 views

Shell script command output in if condition comparison fails to compare to same value string

I'm incorporating a script snippet which determines Android version via: adb shell getprop ro.build.version.release which returns: 4.1.2 or 4.0.4 The snippet currently looks like this: if [ "$(adb ...
0
votes
3answers
127 views

script bash can't get difference in $PS1 or $- when running interactivelly or via cron

I want my cron scripts being executed verbosly when run interactively by a system user (for debug purpose for instance) and quietly otherwise (for cron, as I want receive e-mail if and only if I get ...
2
votes
2answers
150 views

Connecting to a port-knocking protected resource

Considering the excellent answers on the SF question "Preventing brute force attacks against SSH", I am considering configuring port knocking on a test server. I am debating how I will connect to this ...
0
votes
1answer
34 views

Running jobs in a HPC cluster [closed]

I'm quite new to HPC environment. Is there any difference in running a job on a node utilizing 8 cores and running the same job on 8 nodes utilizing I core in terms of performance or walltime used. ...
0
votes
1answer
252 views

Tomcat error checker using bash

Can someone shed me some light, point me in the right direction? I want to create a script in bash that will checks exceptions in the logs during the startup of Tomcat app. This script should be able ...
2
votes
1answer
132 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, ...
25
votes
3answers
2k views

Did a cat /dev/urandom - Broken terminal

Out of curiosity, when your shell character set breaks from doing something like cat /dev/urandom is there a way to fix that in place?
-1
votes
1answer
128 views

`pwd -P` preventing bash script from running in supervisord [closed]

I'm running supervisord to execute gunicorn. My problem is when my script contains CURR_DIR=`pwd -P` and run the script via supervisord, it STOPS the process. My script is located in /var/www/conf and ...
1
vote
2answers
189 views

Adding sleep / delay between iptables blocks in shell script

On one server, we're trying to block any access for the country China. We wish to implement this with iptables rather than via .htaccess. The problem we're experiencing though, is that when adding ...
0
votes
2answers
32 views

Find PHP process that logs to file [duplicate]

I have started a PHP script via browser and due to a loop error the script continues to be executed even after closing the browser. I am noticing it since the script is logging error messages to my ...
0
votes
1answer
48 views

Get last modification date on many SVN repos

I'm hosting svn server for my developers. From server I see all configured dirs with svn repos. I want to get last modification date on all of them(obout 30 different projects). I don't want to ...
2
votes
2answers
44 views

How can I distinguish the base packages from the rest when running rpm -qa?

I wrote a script which along other tasks connects to a remote server and pulls a list of all installed packages and installs them, Like so: echo -e "\e[36m#===# Getting list of packages to install ...
-1
votes
2answers
59 views

Better way to exec at a specific folder

It is possible to exec at the specific folder, rather than I need to use two commands separately? e.g. cd /opt/folderA exec .... cd /opt/folderB exec ....
2
votes
2answers
263 views

check if process is running, even under cron

I have a cron job that runs every minute, but if it finds data, might take many minutes to finish. I need to tell if another instance of the script is running from another. To make things even more ...
2
votes
5answers
260 views

debian bash/sh string execution

I am stuck with this piece of code here user@server:~$ TEST="ssh rsync@otherserver.example.org 'date; hostname -A; uname -a'" user@server:~$ $TEST bash: date; hostname -A; uname -a: Command not ...
3
votes
1answer
207 views

inotify in bash script doesn't work with ldapadd command

I have written a bash script which detects if a .ldif file has been written into a directory and if written, executes an ldapadd command and then deletes that file. The scripts is as follows: ...
0
votes
1answer
73 views

How to set multiple paths with update-alternatives

For example, the following command install java to /usr/bin/java update-alternatives --install /usr/bin/java java /opt/java7/bin/java 1 && update-alternatives --set java /opt/java7/bin/java ...