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

learn more… | top users | synonyms (1)

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
117 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
130 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
767 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
126 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
102 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
35 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
44 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
131 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
137 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
367 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
437 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
310 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
311 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
81 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
360 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
108 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
224 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
4k 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
52 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
225 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
154 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
194 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
143 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 ...
2
votes
1answer
234 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
398 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
919 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
154 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
169 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
263 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
151 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
147 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
214 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
36 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
45 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
62 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
312 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
284 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
230 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
90 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
890 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
489 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
3k 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
113 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
103 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
290 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=... ...