Programming in an Interpreted language executed by a running Shell

learn more… | top users | synonyms

3
votes
4answers
354 views

Bash one-liner that shows a running countdown until a DNS update (TTL expiration)

I find myself frequently tasked with updating DNS records and needing to know exactly when the refresh will begin (a.k.a TTL expiration). I came up with this bash one-liner that gives me the output I ...
1
vote
0answers
51 views

Obtain the free_memory value in xen

I would like to know if there's an alternative to the command I am currently using to get the real free memory for the system (meaning memory that can be assigned to new domU) xm info | grep ...
-1
votes
2answers
152 views

Try the command multiple times [closed]

I need to execute a command and also check if it was successful. If there was an error, I should try again and the following code is working as expected. But what if I need to try the same command 3 ...
1
vote
1answer
54 views

Cronjobs putting archive in wrong directory

I am running a website on an Amazon ec2 instance running the default Debian linux. I set up a cronjob to copy the site files, take a database imprint, and zip them up. I want to keep the file ...
2
votes
1answer
84 views

Hold till last command completes its execution

I am developing a shell script which actually stops aws running instances in a particular region & start them again as a part of schedule maintenance. but as ec2-api tools are heavy, takes time to ...
-1
votes
2answers
2k views

Shell script :: Reading a column from file & store it in array [closed]

I am working on shell script where i want to store O/P of the command in array. I have a file containing rows & columns from where i want to extract 3rd column & store all values in a array. ...
1
vote
5answers
159 views

linux how to tell the process for a script?

I ran a script postData.sh, but when I do "ps -ef", I don't see the script in the list of programs running but I do see extra -bash processes running. How do I determine the pid so I can kill the ...
0
votes
1answer
208 views

Nagios: bash is missing

I'm monitoring NTP server with nagios and nrpe, at the nagios server, when I get the following error: Service Status UNKNOWN Status information I am missing an important component : bash The plugin ...
2
votes
1answer
130 views

How do I find the biggest files on multiple servers and sum up their size?

I am trying to find the biggest files in the /export/home directory and add up (sum) their sizes. Script: #!/bin/bash filename=hostnames > export_home.log while read -r -a line do ...
1
vote
1answer
278 views

Automatic provisioning of Windows server from a Linux client.

Our company builds a server-based C++ application, which can be installed by a Windows installer. I would like to be able to remotely log into a brand new Windows server, and install that C++ ...
1
vote
1answer
93 views

nice command - are other commands executed with script also niced?

A quick question about how nice works. Say if I have a script that runs in the crontab like so 0 4 * * * nice -n 19 /usr/local/admin/script.pl It is set to the lowest priority. This script will ...
-1
votes
1answer
205 views

Bulk BIND zones creation [closed]

How can I create zones for 50 domains on Ubuntu 12 VPS? I have webmin (which allows me to use BIND to create/ manage zones). I was able to figure out what gets created to add a zone successfully. But ...
0
votes
1answer
35 views

Solution to start/stop many instances of one application

I have one tool that performs a long-running task. This tool accepts a configuration file. Right now I need to run simultaneously about 15 instances with different configs (using screen for this). ...
0
votes
2answers
266 views

linux + how to identify if file is pointed by link/s

I create new file called - 192.9.200.1 touch 192.9.200.1 then I create new link that will be pointed to 192.9.200.1 file ln -s 192.9.200.1 file so finally I get: ls -ltr /tmp ...
0
votes
3answers
1k views

Connect to cisco switch using shell script

I would like to run a daily script the cleans my switch arp. I enabled SSH on my switch. how do I connect to the switch using a simple shell script? I'm not sure how to provide the SSH password and ...
0
votes
2answers
121 views

linux + delete duplicate IP's from file

what the best way to remove duplicate IP's from file I use the command: sort file | uniq but I am not sure if this is the best way , maybe I missed something? remark: my file contain two ...
0
votes
1answer
155 views

Hudson kills the process at end of the shell script

Im configuring Hudson to automate deployment process. In shell script I start the server using different user and Im able to see the logs which says server is successfully started and able to access ...
1
vote
2answers
75 views

What is this specific shell script statement validating?

I'm not a good Shell Script expert. Can somebody help me to understand and explain the statement [ ! -z ${TRUE:-} ] && [ ${TRUE:-} == 'true' ] &&from the following snippet. What is ...
-1
votes
1answer
179 views

Can not seem to get expr substr to work

Can anyone tell me what I am doing wrong ? [ /jlr/sub/libexec/vmr-staging ] $ expr substr "onetwothree" 1 4 expr: syntax error I got the syntax from http://stackoverflow.com/a/220464/1150847
4
votes
2answers
170 views

supress expansion of * in echo

I am working on a script which dynamically executes some queries on daily basis. These queries are coming from a table in the database. Here is the sample output of the query table: ...
0
votes
1answer
117 views

Recursively delete empty folders with verbose output

This should be fairly simple, but I am not sure what i'm missing. I'd like to recursively delete empty directories, and get an output for what's being deleted, this command works for sure, but I just ...
2
votes
3answers
873 views

In zsh, how do you redirect stderr to /dev/null within a for or foreach loop?

I am trying to accomplish something that is easy in bash: look for files in a folder and source them if they exist (and do not output if no files exist). In bourne shells this is how to do it: if ...
-1
votes
1answer
421 views

Get Rsync status for output

At the end of a successful rsync job, I get the typical: sent 6022622 bytes received 4751961 bytes 69738.40 bytes/sec total size is 3328464484 speedup is 308.92 I call my rsync job via a shell ...
0
votes
1answer
485 views

Bash: php comand not found when called from a script run with sudo

I have this weird problem. The php command is not found in one specific sitiation. I try to call the command in three different ways. Only one of them fails: Being user john I create a simple ...
1
vote
2answers
33 views

script reading from new descriptor in read

I have a script that asks some questions to the user and repeats the question until the user has answered something appropiate. This is done with an infinite loop that is break'd when an acceptable ...
0
votes
1answer
319 views

can't access sourced variables inside Upstart script stanzas

I'm trying to use the variables defined in /etc/environment in an upstart script. I'm able to export the variable to the child process but for some reason I not able to use them in the upstart script ...
1
vote
2answers
163 views

re-create new link and remove the old link on one command

according to ln manual page: man ln -f, --force remove existing destination files so as I understand if I want to re-create new link to some destination directory/file I can ...
0
votes
0answers
176 views

How to get range time a log file in shell script

How to get range time using awk command? I have two variables $from and $to with format (hh:mm:ss) I want to get the range time between two variables. For example: get all range time between: ...
0
votes
4answers
125 views

How to automatically clean up date stamped logs

I have an apache web server with various virtual hosts. Each virtual host logs to date stamped files using cronolog. The result is that I end up with a lot of files like this: ----rw-r-- 1 root ...
0
votes
2answers
318 views

FreeBSD rc.d scripts do not return to proper shell

My interesting problem is that when running some rc.d scripts they do not actually drop back to the root shell, but leave me at an intermediate shell as the user they're supposed to be running as. A ...
1
vote
2answers
682 views

shell script in crontab, not all output being logged

I've got a simple shell script that runs a few LFTP commands and processes the files. When running straight from bash I get full output of those LFTP commands on screen. When running from crontab ...
-2
votes
1answer
121 views

case + how to implement equal or less or greater in case syntax

my target is to verify the range of number with (only with - case + esac ) , and print the range so for example if number is between 0-80 , case will print >=0<=80 or if range is ...
0
votes
3answers
55 views

Finding the file/script that invoked a process

I do have a high CPU utilization PhP Process. This process in turn seem to invoke mysql and both processes together are using all the CPU cores and RAM using ps aux | grep php , i could get the ...
1
vote
1answer
207 views

Mysql incremental backup and point in time recovery

I have a requirement for doing Incremental backup of MySQL database. For which I'm writing a shell script using the concept of binary logs. Now, the scenario is such that a full-backup will happen ...
-1
votes
1answer
109 views

running script containing sudo in cron [duplicate]

#!/bin/bash value=$(<man.txt) echo "$value" if [ "$value" == "true" ]; then echo "startedif_manthan" ps -ef|grep sym |awk '{ print $2 }'|sudo xargs kill -9; sleep 30; sudo sh ...
-1
votes
3answers
73 views

Cannot start a script

#!/bin/bash value=$(<man.txt) echo "$value" if [ "$value" == "true" ]; then echo "startedif_manthan" ps -ef|grep sym |awk '{ print $2 }'|sudo xargs kill -9; sleep 30; sudo sh ...
-1
votes
1answer
43 views

Different behavior from ubuntu server and ubuntu client on windows [closed]

#!/bin/bash # Reading cat /home/radiare/Desktop/first.txt | while read LINE do if [ "$LINE" == "false" ]; then echo "Inside first loop" break fi done cat /home/radiare/Desktop/second.txt | while ...
-3
votes
2answers
81 views

perl one liners + add empty line after the last line [closed]

please advice what need to change in the perl syntax in order to add new empty line after the last line? example IP_INFO=12.23.2.1 echo IP= | perl -pe "s/$/$IP_INFO/" 1>>file . ...
1
vote
4answers
75 views

Howto: command/tool ability check

When developing a shell script that should run on various unix/linux derivates, i sometimes have the problem that some tools have to be called in a different way compared to other systems. For example ...
0
votes
1answer
83 views

ZSH escaping / file matching pattern

This works from command line: scp -r ^.git b:/home/wopi/blyzics/. when I paste the above line in a script like this: #!/usr/bin/env zsh scp -r ^.git b:/home/wopi/blyzics/. And run it ...
0
votes
1answer
252 views

ssh tunnel and rdesktop in one line

To access a windows machine remotely I have to tunnel through a ubuntu server of mine. To setup the tunnel I have ssh -l root -C -L 9999:windowsmachine:23389 myserver Then I have to open another ...
-1
votes
3answers
251 views

Script to restart httpd if crashed

With heavy trafic, it happen that's my HTTP service crash on my dedicated server. Then, I have to restart httpd service manually. I just search for a shell script that's detect if HTTP service is OK ...
1
vote
1answer
93 views

escaping spaces in shell script

yesterday="2010-06-23 00:00:00" today="2010-06-24 00:00:00" mywhere="lastupdate>'$yesterday' and lastupdate<'$today'" mysqldump $param ticket --no-create-info --where=\"$mywhere\" The last ...
0
votes
3answers
4k views

how to run shell commands from apache (through php )

I'm using redhat 6 I have the following shell commands that I need to run from the webserver (apache -> through php ) that basically move & overwrite a file , kill a process and starts another ...
3
votes
1answer
162 views

echo $? doesn't work when executed remotely

When I execute a command as below it gives me an output as expected but when I run the same command on remote server it always gives me echo $? as 0. locally # <some command> # echo $? ...
13
votes
4answers
32k views

How do I sleep for a millisecond in bash or ksh

sleep is a very popular command and we can start sleep from 1 second: # wait one second please sleep 1 but what the alternative if I need to wait only 0.1 second or between 0.1 to 1 second ? ...
0
votes
1answer
279 views

Using NFS mount script with grandfather father-son script but only getting 6 daily backups. I should also have 4 weekly and 2 monthly backups

I'm using rsync to clone changes from a remote server(MT DV4.0) to a local one(ubuntu 11.10). I'm then using the following copy/paste script to compress then archive the files. #!/bin/bash ...
0
votes
2answers
179 views

Issues in Play framework Server when I start using su deploy -c “play start”

I have play framework server and Im doing Automation using Hudson, When I start the play server using su deploy -c "play start" it's fine the logs are getting updated and server is started. The same ...
0
votes
1answer
208 views

How to combine outputs of ps and lsof

Usually output of ps has a pid somewhere. Is there a way to combine this, preferably with a one-liner, with an output of lsof ? e.g. 27915 ? Ss 0:03 gpg-agent --daemon gpg-agent 27915 ...
-1
votes
2answers
205 views

shell: create Shortcut command (alias or function) for working with IP address as arguments

I am not sure if I performed the following illegal or true but what I need is - to create set of ready commands so if I need to use , for example to match IP address with 4 octet I can use the ...