running command more than twice in one second?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting running command more than twice in one second?
# 1  
Old 12-06-2006
running command more than twice in one second?

how do i do that?

say i wanna run a check script but i want it to run at least twice in one second, what kinda script would that need? matter,

this on a sunsolaris system.

i would like it to run as many times as possible under one second but i guess i can live with 2 so does anyone know how to do this?
Terrible
# 2  
Old 12-06-2006
To repeatedly run a command as fast as possible try:
Code:
#! /usr/bin/ksh
while : ; do
      command
done

Assuming that "command" takes less than .5 seconds you should be ok.
# 3  
Old 12-07-2006
More control can be obtained by using Perl's select statement:

#!/bin/perl

# loop
while () {
system("command");
select(undef, undef, undef, 0.25); ## Pause for 25 miliseconds
}
# 4  
Old 12-07-2006
Quote:
Originally Posted by vishadow
More control can be obtained by using Perl's select statement:

#!/bin/perl

# loop
while () {
system("command");
select(undef, undef, undef, 0.25); ## Pause for 25 miliseconds
}

thanks a million. this is exactly what i'm looking for. thank you. thank you Smilie
Terrible
# 5  
Old 12-11-2006
Sorry for the late response. You're welcome!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Another one line command where I'd like to determine if Ubuntu or Red Hat when running command

Hello Forum, I'm making very good progress on my report thanks to the very helpful people on this forum. I've been able to successfully create my report for my Red Hat servers. But I do have a few ubuntu servers in the mix and I'd like to capture some data from them when an ssh connection is... (8 Replies)
Discussion started by: greavette
8 Replies

2. AIX

I'm facing problem with rpm command, when running the command and appears this error:

exec(): 0509-036 Cannot load program /usr/opt/freeware/bin/rpm because of the following errors: 0509-022 Cannot load module /opt/freeware/lib/libintl.a(libintl.so.1). 0509-150 Dependent module /opt/freeware/lib/libiconv.a(shr4.o) could not be loaded. 0509-152 Member... (4 Replies)
Discussion started by: Ohmkar
4 Replies

3. UNIX for Dummies Questions & Answers

At command not running out of hours

Hi All, new to the forum and new to Unix but I have an issue which is annoying on a new level. I have included a short and full version for anyone needing more information. Short Version I am running a set of scripts that work and run fine. one of the scripts arranges the first... (4 Replies)
Discussion started by: Delboy4000
4 Replies

4. Shell Programming and Scripting

Command to check only Autosys running jobs with autorep like command

Hi, Is there any specific command to use to check only say Running jobs via autorep or similar command for Autosys? (0 Replies)
Discussion started by: sidnow
0 Replies

5. Shell Programming and Scripting

Running command using SSH

Hi All, I am trying to run my script using ssh. Below is the code snippet #!/bin/bash ssh username@useipapd03 'bash -s' #To ensure If JMSdirectory exists or not if then echo "JMS mounts................exist'>>OutputResult.txt else echo "JMS mounts................not... (10 Replies)
Discussion started by: sharsour
10 Replies

6. UNIX for Dummies Questions & Answers

Running set options from the command line and bash command

I'm reading about debugging aids in bash and have come across the set command. It says in my little book that an addition to typing set you can also use them "on the command line when running a script..." and it lists this in a small table: set -o option Command Line... (5 Replies)
Discussion started by: Straitsfan
5 Replies

7. Shell Programming and Scripting

Could not get script name running from ps -ef command ?

hi.. i have one perl script called sendsms.pl. After i execute the perl script as background process and run ps -ef, it did not display the filename. It was display as "/usr/bin/perl". How could execute the perl program and display the filename using ps command ? #./sendsms & #ps -ef |grep... (3 Replies)
Discussion started by: bh_hensem
3 Replies

8. Shell Programming and Scripting

command job not running

Hi, I have an autosys box job and 2 command jobs. When i force start the box job the command jobs are moving to 'Active' state but are not running. I have tried various options for the start times and run windows but doesnt seem to work. Any help is appreciated update_job: job1.jil... (1 Reply)
Discussion started by: userscript
1 Replies

9. Shell Programming and Scripting

sed command not running

I am using solrais 10 on sun sparc. The following command executes successfully echo c:/test.txt | sed -e 's/\//\\\//g' But when i executes the following command x=`echo c:/test.txt | sed -e 's/\//\\\//g'` I get the following error sed: command garbled: s/\//\\//g Is there any way to avoid... (3 Replies)
Discussion started by: mmunir
3 Replies

10. SuSE

inconsistent ls command display at the command prompt & running as a cron job

Sir, I using the following commands in a file (part of a bigger script): #!/bin/bash cd /opt/oracle/bin ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out If I run this from the command prompt the result is: 2007-05-16 if I run it as a cron job then... (5 Replies)
Discussion started by: rajranibl
5 Replies
Login or Register to Ask a Question