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

learn more… | top users | synonyms (1)

1
vote
3answers
81 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
98 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
307 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
226 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
38 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 ...
0
votes
2answers
94 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
201 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
57 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
222 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
72 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
159 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
1k 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
49 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
183 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
88 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 ...
3
votes
2answers
95 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
117 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 ...
0
votes
1answer
133 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
252 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 ...
1
vote
2answers
355 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
108 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
124 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
29 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
176 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
119 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, ...
24
votes
3answers
1k 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
102 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
175 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
29 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
43 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
58 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
208 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
229 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
162 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
43 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 ...
2
votes
3answers
283 views

bash gunzip | untar multiple files in separated folders

I have a list of .tar.gz files with the same inner folder structure and I'd like to batch gunzip | untar a single file from them in separated folders. logs_2013-08-01.tar.gz logs_2013-08-02.tar.gz ...
2
votes
3answers
179 views

how to convert a running process into a nohup and keep a logfile

I have a process currently occupying a terminal ]$ command some_argument I want to exit from the terminal and go home, but in the mean time I don't want to kill this running process. For the ...
1
vote
2answers
1k views

Bash script count down 5 minutes display on single line [closed]

I would like to have a count down of 5 minutes, updating every second and showing the result on the same line. Is this even possible with Bash scripting?
1
vote
2answers
75 views

If I know the PID number of a process can I know its name?

If I have the PID number for a process (on a UNIX machine), how can I know the name of its associated process? What do I have to do?
0
votes
1answer
66 views

Script to move Maildir contents to its parent dir but for multiple folders

I totally suck at Bash/Python/Ruby/Perl Scripting (need to practice/learn some more) so I'm asking for a little help :-) I need to move about the contents of about 60 Maildirs to their parent folder ...
1
vote
1answer
139 views

bash: setting environment variables from a script and leave a shell prompt

I'm looking for a way to create some kind of a 'setup' script that would set environment variables and at the end leave the user with a bash command prompt. for example: #!/bin/bash export PATH=... ...
1
vote
1answer
97 views

Script doesn't work as cron job [closed]

I have a script that I wrote to verify on an OS X machine (v 10.7.4) if a volume is up or down. If it goes down, it is supposed to send an email. When I run the script from the command line, it works ...
0
votes
2answers
35 views

Script or Someway to Watch People Downloading Files from My Server (HTTP)

I am trying to figure out a way to in real time see people downloading files to ensure that the download from that person is successful. I cant seem to get the search string right to find what i need. ...
0
votes
1answer
55 views

Is it possible to pass a machine's hostname as subject of the command `mail` in linux?

I'm trying to extract some information from a list of servers and so I wrote this one liner which I will then pass through ssh user@machine 'command': # hostname > info ; cat /etc/*-release | awk ...
15
votes
2answers
584 views

Bash Prompt Below Output - Background Log Tail

I used to work for a company who had a customised shell for management of one of their products that was running on Linux and I'm looking to replicate a key feature of this shell. All the work was ...
2
votes
2answers
67 views

How to obtain last bash error

I am working with a terrible project. It uses a lot of messy shell script in background. Script might include some other scripts. And many error outputs were redirected to /dev/null. When a script is ...
0
votes
1answer
235 views

OpenVPN run script after tunnel is set up

I'm having a hard time figuring out exactly how can I update my A records on my cloudflare account. I have already set up a script that checks for IP changes, and pushes the changes through the ...
2
votes
1answer
159 views

adding PATH in /etc/profile and ~/.bash_profile but not showing via SSH [duplicate]

on Centos 6.x, I am adding some path export PATH=$PATH:/some/path in both /etc/profile and ~/.bash_profile but if it's not effective when I login via SSH it only shows if I type source ...
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 ...