The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
97 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
102 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
72 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
104 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
166 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
107 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
723 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
143 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
233 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
32 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
207 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
139 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
137 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
121 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
248 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
478 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
97 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
52 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
180 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
69 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
70 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
42 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
78 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
71 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
76 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
200 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
224 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
86 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
3k 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
154 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 $? ...
10
votes
4answers
19k 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 ...
0
votes
1answer
237 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
159 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
165 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
186 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 ...
-2
votes
1answer
116 views

linux + count how many digits in IP address [closed]

I write the following syntax (exist in my ksh script) in order to find how many digits I have in IP address IP_address=127.1.1.1 echo $IP_address | sed s'/\./ /g' | wc | awk '{print $2}' 4 . ...
-1
votes
1answer
213 views

shell script - while loop, handle the exception

I am running a shell script with a while loop and it exits with the below error, how could I avoid it or catch the error and let the loop to continue ? ie how could I handle the exception stty: ...
-1
votes
4answers
134 views

Shell script for loop is behaving unexpected [closed]

Shell script for loop is behaving unexpected ! The requirement is need to iterate the loop line by line of the property file. Its mandatory to use the for loop. hostnamefl=/tmp/propperty.txt for ...
0
votes
2answers
112 views

Oracle Golden gate version using shell scrip

I am trying to grep the Oracle golden gate from a remote machine, But along with version it is giving some error details also, How do I resolve it ? user@serverhost:/dbei > echo <golgengate ...
0
votes
3answers
188 views

grep + Regular Expressions to match uniq number

My target is to verify if $FILE is a backup file ( backup file ended with xxxx.xx.xx.xx number Example of backup files ls /etc/VRTSvcs/conf/config main.cf.17Dec2012.09.10.14 ...
-1
votes
2answers
846 views

Configure the UPS apcupsd demon to run a script?

I have a ups connected to a Linux server with a usb cable, i installed apcupsd demon and i was wondering how to instruct it to run a shell script i created when a special condition occurs? i.e. the ...
0
votes
1answer
249 views

linux cron mysqldump: php exec() vs shell script vs direct command in crontab

The system is running CENTOS 5.8, Apache 2.2.3, MySQL 5.0.95, PHP 5.3.3 We run mysqldump daily for a few databases. It's run via a php script called in crontab. They are run at the same time and ...
0
votes
1answer
88 views

Linux/Solaris verification ( after hostname change ) in files according to hostname rule

According to the following Perl command ( this command part of ksh script ) I can replaced old hostnames with new hostnames in Linux or Solaris previos_machine_name=linux1a ...
1
vote
5answers
134 views

Solutions for scheduling cronjob

I have setup a list of cron, Some of the cron script takes a long time to run (like 1-5 hours, and they are increasing every day). I do not want to run two cron scripts at the same time, as I do not ...
0
votes
2answers
850 views

linux\solaris + print specific date format from file

subject - print file date on solaris as format: yymmdd ( yy - year , mm - month , dd - day ) on Linux machine I type the following command in order to get: file date as the following: ls -l ...
0
votes
2answers
326 views

How to add a variable into a grep command

I'm running the following grep command var=`grep -n "keyword" /var/www/test/testfile.txt` This work just as expected but I need to insert the file name dynamically from a loop like so: var=`grep ...
0
votes
2answers
133 views

linux/solaris + how to verify OS (linux / solaris ) creation date

Please advice – how to verify OS (linux / solaris ) installation creation date which file/packages/other – can be good indication when the operation system was created/installed ? For example I ...
1
vote
3answers
444 views

linux/solaris kill many proccess with one command

Is it possible to kill all find process with one command? I do not want to kill each process as kill -9 25295 , kill -9 11994 , etc.. Rather, what I want is a simple way or command that kill all find ...
0
votes
1answer
191 views

perl + sed + remove lines that start with “#”

please advice I have linux and solaris machines, and I need command that work on both OS I use the following perl line in order to remove all lines that start with "#" why perl command not work , ...
1
vote
1answer
163 views

Tool to correlate logs by timestamp

I have various log files, some with the same format (webserver + webserver SSL), some with different formats and even different timestamps. How can I correlate these log files together in a simple ...