Run a script on the hour but only for 30mins

Hi All,

I want to run a script on the hour during a 24 - hour period; easy enough cron will take care of that..however I want the script to only run for only 30mins..

so with the script it knows its 30mins are up so exits.

any ideas?

Any help, greatly appericated.

Thanking you all inadvance.

you can put the below lines as the first lines of your script..

#!/bin/sh
echo $$ > /tmp/myprog.lck
echo sleep 1800 > mytmp.sh
echo kill -9 \`cat /tmp/myprog.lck\` >> mytmp.sh
sh mytmp.sh &

while true; do echo ilan; sleep 2; done #here your script content goes instead of while loop
exit 0

this will terminate itself in 30 minutes...

-ilan

You Sir are a genius !