[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

script timer



Hi, 

Can any one help me out? I have a small program, which should be execute
every 5 sec. I have a simple script as following:


#!/bin/sh

while [ "forever" ]
do

	exec myfile

	sleep 5s
done


It seem just can execute one times. How can I set this timer on and run
myfile in every 5 sec.




I also try to write a C program to approach this prolem.

My C code is as following:

#include <stdio.h>
#include <unistd.h>

void man (void) {

	while (1)
	{

		execl ("/home/myfile", "myfile", NULL);
		/* myfile have been compiled to be executable and put on
		   /home/ */

		sleep(5);
	}
}

In the C code case, it still just executes one time?


Can any help me out?

Thanks,

C.L.


****************************************************************************
Chien-Lung Wu						cwu4@xxxxxxxxxxxx
Graduate Student of ECE 				(O) 919-513-1894
at North Carolina State University			(H) 919-233-6724
****************************************************************************


- --------------------------------------------------------------------
For more information on Linux in India visit http://www.linux-india.org/
The Linux India mailing list does not accept postings in HTML format.

------------------------------