timers in unix
5 posters
timers in unix
ny idea as to how to implement timers in unix???
tat is i want to execute a particular command at regular intervals.....how cud i do this???
tat is i want to execute a particular command at regular intervals.....how cud i do this???
akalya- Posts : 70
Points : 86
Join date : 2010-03-04
Re: timers in unix
You can put it in a while loop and use sleep(5).It will pause for 5 sec and den resume.
say while(1)
do
some code
sleep(5)
done
say while(1)
do
some code
sleep(5)
done
Maithreyi- Posts : 76
Points : 142
Join date : 2010-03-03
Age : 36
Location : Haldia
Re: timers in unix
[335723@oracleclient ~]$ sleep 5 && cat hello.txt
it can be used for single line command.......
it ll delay 5 secs .....
it can be used for single line command.......
it ll delay 5 secs .....
anand- Posts : 55
Points : 70
Join date : 2010-02-26
Age : 36
Re: timers in unix
Thanks
but how to do u repeat the execution of a particular command
say every 5sec i want to display hello world msg
but how to do u repeat the execution of a particular command
say every 5sec i want to display hello world msg
akalya- Posts : 70
Points : 86
Join date : 2010-03-04
Re: timers in unix
for ((i=0 ;; i++))
do
echo hello
sleep 1
done
how about this!!
do
echo hello
sleep 1
done
how about this!!
jeeva- Posts : 50
Points : 93
Join date : 2010-03-04
Permissions in this forum:
You cannot reply to topics in this forum
|
|