unix sleep and date commands


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers unix sleep and date commands
# 1  
Old 10-04-2007
unix sleep and date commands

please help me to fix my script trying to use sleep 2 minutes while the system is sleeping i want to print out same message every 5 seconds
thanks
t=`date +%S`

while [ t = t+120 ]
do
sleep 5

echo "this program will end in 2 minute"
done
# 2  
Old 10-04-2007
I would use "bc" to do the calculation.

WAITSECS=`echo $WAITSECS - 5 | bc`
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

1000 sleep commands on a Linux Server impact?

Hi All, I have a shell script, at one point it try to ping a server in our organization network, if ping fail it will wait for an hour using sleep command and try to run the script again from the beginning. I'm wondering what could be the possible impact on my Linux server if 1000 sleep... (5 Replies)
Discussion started by: SaddamAB
5 Replies

2. UNIX for Beginners Questions & Answers

UNIX script to replace old date with current date dynamically in multiple files present in a folder

I am trying to work on a script where it is a *(star) delimited file has a multiple lines starts with RTG and 3rd column=TD8 I want to substring the date part and I want to replace with currentdate minus 15 days. Here is an example. iam using AIX server $ cat temp.txt RTG*888*TD8*20180201~... (1 Reply)
Discussion started by: Shankar455
1 Replies

3. Shell Programming and Scripting

Usage of Sleep in UNIX

Hi Guys, In my script i need to sleep for some seconds till the previous command exeuction is successful #!/bin/bash cp test.txt /direct/sub_dir if ; then echo "file copied" else echo "file not copied" sleep 5 exit 1 fi i need to sleep for 5 seconds if the copy command... (7 Replies)
Discussion started by: Master_Mind
7 Replies

4. Shell Programming and Scripting

UNIX cmd -find empty files in folder else sleep for 8hrs

Hello, I am trying to write a unix cmd , that if files in folder /path/FTP are all zero kb or empty then good to go, if not empty then sleep for 8 hrs. Following cmd list me the files which are not empty, But when I am incorporating IF ELSE cmd fails find /path/FTP. -type f -exec wc -l {}... (6 Replies)
Discussion started by: bluestarmoon
6 Replies

5. UNIX for Dummies Questions & Answers

Find Commands Run on Specific Date

Hello All, I was wondering if anyone knew of a way to find out what commands were run on a specific date. I'm looking to see if I can find certain commands that were run on 3/4, today is 3/10...? Any thoughts or ideas would be much appreciated! Thanks in Advance, Matt ----------... (3 Replies)
Discussion started by: mrm5102
3 Replies

6. UNIX for Advanced & Expert Users

Floating point argument for sleep command in Unix

Hi , How can I use floating point argument for sleep command in unix.I cannot use usleep as it is not suppported. Also how can I find out that a file is in use at that particular instant only.(wether it is being read or written) (7 Replies)
Discussion started by: kanus
7 Replies

7. Shell Programming and Scripting

Wrapping 'sleep' with my 'resleep' function (Resettable sleep)

This is a very crude attempt in Bash at something that I needed but didn't seem to find in the 'sleep' command. However, I would like to be able to do it without the need for the temp file. Please go easy on me if this is already possible in some other way: How many times have you used the... (5 Replies)
Discussion started by: deckard
5 Replies

8. Shell Programming and Scripting

To remove date and duplicate rows from a log file using unix commands

Hi, I have a log file having size of 48mb. For such a large log file. I want to get the message in a particular format which includes only unique error and exception messages. The following things to be done : 1) To remove all the date and time from the log file 2) To remove all the... (1 Reply)
Discussion started by: Pank10
1 Replies

9. Shell Programming and Scripting

Compare date from db2 table to yesterday's Unix system date

I am currently running the following Korn shell script which works fine: #!/usr/bin/ksh count=`db2 -x "select count(*) from schema.tablename"` echo "count" I would like to add a "where" clause to the 2nd line that would allow me to get a record count of all the records from schema.tablename... (9 Replies)
Discussion started by: sasaliasim
9 Replies

10. Shell Programming and Scripting

how to print date using ftp commands

Hi friends sftpCmd.txt ----------------- !echo "Getting files from sftp" !echo "----------------" cd /home/msgGoogle/PLATFORM/PROD/MIMUS/outbound/ARCHIVE/invsnap !echo "folder created" !date mget ???050108*.txt output !echo "------------------" !echo "Completed : " !echo... (3 Replies)
Discussion started by: kittusri9
3 Replies
Login or Register to Ask a Question