60 second Timer with Shell Script

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting 60 second Timer with Shell Script
# 8  
Old 10-04-2009
Originally Posted by danmero

(Code reformatted for legibility.)
while [ $i -gt 0 ]
 if [ $i -gt 9 ];then
   printf "\b\b$i"
   printf "\b\b $i"
 sleep 1
 i=`expr $i - 1`

That loop will take noticably longer than one second, due partly to the unnecessary external command.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help please with FTP timer script

Hi Could somebody please help me with this code? ------------------------------------------ @ftp -i -s:"%~f0"&GOTO:EOF open mysite.co.uk myusername mypassword !:--- FTP commands below here --- cd public_html/ binary lcd c:\ put myfile.jpg bye ... (3 Replies)
Discussion started by: dobbies
3 Replies

2. Shell Programming and Scripting

Looping in the shell script with help of script timer.

Hello Experts- We are facing some issues in the while loop script when we use the script time to decide whether to exist from the loop or continue. Below is the script SrcExitLoop="FALSE" Src_InitialStartTime=`date +%s` Src_StartTime=`date +%s` Src_NUM_ALERTS=0 TOTAL_ALERTS=`expr <SOME... (4 Replies)
Discussion started by: Amey Joshi
4 Replies

3. UNIX for Dummies Questions & Answers

Shell Script / Timer

Hey folks, We already got a working Script running, but actually we gotta start it manually but at least we want to run it like every 30minutes 1time. Could anyone give it a shot? #!/bin/sh for i in A B C D E F G H I J K L M N O P Q R S T U V W X Z do ln -sv /x/$i/*/PDF/001-*.*... (1 Reply)
Discussion started by: Yjerith
1 Replies

4. Shell Programming and Scripting

Perl script timer on program launch

So I am attempting to get a short but complex perl script to be able to time out an application that I will launch from a command line. The terminal I use is MKS C SHELL and I am having trouble doing the a job spawn that will launch the application and keep time on it. I know you could do this... (1 Reply)
Discussion started by: vas28r13
1 Replies

5. UNIX for Dummies Questions & Answers


is there a timer function in unix without using C? for example i want to display a message after 5 seconds how do i do that? (2 Replies)
Discussion started by: khestoi
2 Replies

6. Shell Programming and Scripting

Startup Script "run process with Timer"

Hi I have a script that execute every X minute for checking new files in a folder and converting to pdf. Is there any way to start this script automatically on linux startup?. I use sleep function in script with infinite loop. while do killall -u `whoami` -q soffice soffice... (0 Replies)
Discussion started by: zawmn83
0 Replies

7. Shell Programming and Scripting


Is there a way to make a timer? E.g Please give the seconds... ... (6 Replies)
Discussion started by: aekaramg20
6 Replies

8. Shell Programming and Scripting

Simple script? First timer...

Hey guys, I'm brand new to the bash scripting world, here's my issue.. When people SSH to my box, I'm wanting to use screen to monitor them if I so choose. So, I've created a new user: testing, and I've set its startup shell to /bin/myshell.sh whose contents read this: #!/bin/sh $me =... (4 Replies)
Discussion started by: poon
4 Replies

9. UNIX for Dummies Questions & Answers

script run timer

any of you guys have a script for measuring the run time of any given script, where you would sandwich your own script between the timer script or something? thanks! :) (2 Replies)
Discussion started by: mark_nsx
2 Replies

10. Shell Programming and Scripting


Hi all, Wanted to a create a shell script ----------------------------------------------------------------------- 1) which when called will start a timer and wait for 48 hours. after 48 hours it will call some function(say XYZ) 2) Whenever this shell script is called (can be called... (3 Replies)
Discussion started by: k_oops9
3 Replies
Login or Register to Ask a Question
IO::Async::Timer::Periodic(3pm) 			User Contributed Perl Documentation			   IO::Async::Timer::Periodic(3pm)

"IO::Async::Timer::Periodic" - event callback at regular intervals SYNOPSIS
use IO::Async::Timer::Periodic; use IO::Async::Loop; my $loop = IO::Async::Loop->new; my $timer = IO::Async::Timer::Periodic->new( interval => 60, on_tick => sub { print "You've had a minute "; }, ); $timer->start; $loop->add( $timer ); $loop->run; DESCRIPTION
This subclass of IO::Async::Timer implements repeating events at regular clock intervals. The timing may or may not be subject to how long it takes the callback to execute. Iterations may be rescheduled runs at fixed regular intervals beginning at the time the timer was started, or by a fixed delay after the previous code has finished executing. For a "Timer" object that only runs a callback once, after a given delay, see instead IO::Async::Timer::Countdown. A Countdown timer can also be used to create repeating events that fire at a fixed delay after the previous event has finished processing. See als the examples in "IO::Async::Timer::Countdown". EVENTS
The following events are invoked, either using subclass methods or CODE references in parameters: on_tick Invoked on each interval of the timer. PARAMETERS
The following named parameters may be passed to "new" or "configure": on_tick => CODE CODE reference for the "on_tick" event. interval => NUM The interval in seconds between invocations of the callback or method. Cannot be changed if the timer is running. first_interval => NUM Optional. If defined, the interval in seconds after calling the "start" method before the first invocation of the callback or method. Thereafter, the regular "interval" will be used. If not supplied, the first interval will be the same as the others. Even if this value is zero, the first invocation will be made asynchronously, by the containing "Loop" object, and not synchronously by the "start" method itself. reschedule => STRING Optional. Must be one of "hard", "skip" or "drift". Defines the algorithm used to reschedule the next invocation. "hard" schedules each iteration at the fixed interval from the previous iteration's schedule time, ensuring a regular repeating event. "skip" schedules similarly to "hard", but skips over times that have already passed. This matters if the duration is particularly short and there's a possibility that times may be missed, or if the entire process is stopped and resumed by "SIGSTOP" or similar. "drift" schedules each iteration at the fixed interval from the time that the previous iteration's event handler returns. This allows it to slowly drift over time and become desynchronised with other events of the same interval or multiples/fractions of it. Once constructed, the timer object will need to be added to the "Loop" before it will work. It will also need to be started by the "start" method. AUTHOR
Paul Evans <leonerd@leonerd.org.uk> perl v5.14.2 2012-10-24 IO::Async::Timer::Periodic(3pm)

Featured Tech Videos