Programming in an Interpreted language executed by a running Shell

learn more… | top users | synonyms

13
votes
4answers
34k 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
283 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
186 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
213 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
209 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
124 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
248 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
138 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
133 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
218 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 ...
0
votes
2answers
1k 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
324 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
94 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
163 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
1k 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
539 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
179 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
654 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
270 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
209 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 ...
2
votes
2answers
803 views

trap “” HUP v.s Nohup ? How can I run a portion of shell script in nohub mode?

I want to run a shell script over the weekend, but I wanna make sure if the terminal loses the connection, my script won't be terminated. I use nohup for the whole script invokation, but I also want ...
2
votes
2answers
1k views

How can I kill and wait for background processes to finish in a shell script when I Ctrl+C it?

I'm trying to set up a shell script so that it runs background processes, and when I ctrl+C the shell script, it kills the children, then exits. The best that I've managed to come up with is this. It ...
2
votes
1answer
86 views

Distributing a custom command line tool to enterprise servers

I've been tasked with building a command line tool that we will be providing to our enterprise customers so that they can use the API to upload data to our platform. The API works with standard cURL ...
2
votes
2answers
4k views

How to set postgresql user password in bash script

I want to set a password for the default Postgresql server user, postgres. I did it by using: sudo -u postgres psql # \password postgres I want to do this step in many machines, so I would like ...
-4
votes
2answers
402 views

Check a list of passwords strength [closed]

Is there any way to check a list of passwords whether they strong or not? I have a list of passwords, around 2000, and want to check them against this policy Password must contain a minimum of ...
-1
votes
2answers
371 views

Simple dig output?

In a script I want to be able to write an IP address to somewhere easily, so I thought using dig (or a similar command) with back-ticks. However the simplest output I've been able to come up to wrt ...
0
votes
3answers
4k views

Command does not execute in crontab while command itself works just fine

I have this script from Colin Johnson on Github - https://github.com/colinbjohnson/aws-missing-tools/tree/master/ec2-automate-backup It seems great. I have modified it to send email to myself every ...
0
votes
2answers
610 views

Root crontab not executing script

I have a script listed in my roots crontab 07 9 * * * /opt/HLRSDATA_2010_OCT/HLRS_Scheduler_sp.sh > /opt/HLRSDATA_2010_OCT/logs/HLRTKJob.log This script contains the following #!/bin/bash echo ...
0
votes
1answer
107 views

solaris + manipulate lltconfig command

I work on Solaris 10 machines (eg de1a and du1b). Regarding the lltconfig command, is it possible to view only one device (eg NIC e1000g0) and not the entire list? For example I want to get only ...
1
vote
1answer
128 views

solaris + match the network device name according to IP address

how to find the device name as ( e1000g2 , e1000g3 , etc ) according to his IP address on Solaris machine for example ifconfig -a | grep 10.106.134.133 inet 10.106.134.133 netmask ...
1
vote
2answers
123 views

ksh + match and verify two strings in single line

how to match the words linux1a and linux1b from single line ? ( should be performed by ksh ) list="solaris1a Auto global linux1a linux1b" echo $list | .... ? my target is to find ...
0
votes
1answer
310 views

SFTP download the files and then i wanted rename the server files how to do this?

I have to setup with the banking interface where I need to connect to the remote bank and then download the files in the bank server in-box to my local server for further processing so i do following ...
1
vote
1answer
74 views

tar + tar not open all files

When I want to view the following tar file , then tar show the following three files from /var/tmp tar tvf fix.tar install.sh /usr/cti/apps/swp/dir/script1.sh ...
0
votes
2answers
735 views

How to hide/masquerade password in script

I use the following script to change Open Directory (Apple's LDAP) passwords. I don't like leaving the actual password within the script -- is there any way to hide or masquerade this so the script ...
0
votes
4answers
160 views

Assigning environment variables for CRON

I have a .sh script that creates a .tar.gz file and transfer's it to a remote server using RSA keys for authentication. The script will run from terminal but it will not when I try to set it up as a ...
2
votes
2answers
560 views

CentOS 6.2 cron.daily

I created a new file "dbbackup" in /etc/cron.daily that contains a simple database backup script. #!/bin/sh mysqldump -h localhost -u user -p'passord' database_name > ...
2
votes
3answers
187 views

bash + how to match string that include characters and numbers

please advice - what's wrong with my syntax ? ( should not print the "bad interface " ) remark - I work with bash shell ETH_NAME=eth0 ( or any other as eth1 or eth2 .... ) echo $ETH_NAME ...
0
votes
1answer
190 views

How to make a Bash Script take user input for Changing a Password

The following command on OSX will change an Open Directory (Apple's LDAP) password. The $ is the prompt: $ dscl -u diradmin -P 'password' /LDAPv3/127.0.0.1 passwd /Users/username newpassword I ...
0
votes
1answer
405 views

expect script + how to perform case in expect script

the following expect script target is to print the hostname name from linux/solaris machine and according to hostname results expect script will run linux.ksh or solaris.ksh script ...
0
votes
1answer
342 views

expect script + write “if” in expect script

please advice what's wrong with my exepct syntax ( I run expect in ksh script on Solaris 10 machine ) I want to verify if OS is linux so if it true the expect check if prompt is "#" or ">" and ...
1
vote
2answers
214 views

Different behaviour of script locally and over ssh

I have a script on a server-A Script-A #!/bin/bash -l echo "script-A.sh" | change-environment.sh When I ssh onto server-A and execute it, it works fine. However, when I ssh user@server-A ...
1
vote
1answer
133 views

The plugin of munin is always timed out

I want to use munin to make a graph of ttyACM0 in Linux, but munin can not create the graph. I found some information in "munin-node.log". it shows that "Service 'temperature' timed out". So I changed ...
0
votes
2answers
983 views

Shell Script to Start Mysql Server if not running

I have written a shell script to start mysql server & send a mail to admin user if it's restarted via shell script. What i am facing an issue if I run this shell script on terminal it's work ...
0
votes
3answers
253 views

Files copying between servers by creation time

My bash scripting knowledge is very weak that's why I'm asking help here. What is the most effective bash script according to performance to find and copy files from one LINUX server to another using ...
1
vote
1answer
321 views

Configure Postgres on Server A to pg_restore onto Server B (requiring certificate authentication)

I'm trying to configure a PostgreSQL instance running on SERVER_A to connect to another PostgreSQL instance on SERVER_B. I'm running a shell script on SERVER_A that ultimately needs to connect and ...
0
votes
2answers
333 views

Shell script to fix bad filenames? [closed]

I'm IT at my small firm; and, despite my dire warnings, everyone puts files on the server with awful names, including leading & trailing spaces, bad characters (including \ ; / + . < > - ...
0
votes
2answers
2k views

syntax error near unexpected token `then'

I created bash script wich works as Nagios plugin. Here is a part of it: 44 CURDUPLEX=`ethtool $IFACE|grep "Duplex"|cut -d ':' -f 2|xargs` 45 CURSPEED=`ethtool $IFACE|grep "Speed"|cut -d ':' -f ...
-4
votes
2answers
36 views

list the identical words from fiel [closed]

how can I list the identical words from below file using shell script ? list.txt LT R LT MRTD LT MK RR RR example result : LT R MRTD MK RR
-3
votes
2answers
157 views

Split List of ids in to integer and string? [closed]

I am having a list of ids (total 2 lakh), I want to write a shell script to split the ids (string and integer) using shell script . Example given below : IDlist.txt: | LT345 | | R567 | ...
0
votes
2answers
2k views

How to avoid syntax error on missing command line arguments?

How to avoid syntax error on missing command line arguments? Example shell script: var1=$1; var2=$2; echo $var1 echo $var2 var3=`expr $var1 + $var2`; echo $var3 Output : shell>sh ...