Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone have a script to schedule a job and remove once run ? 1

Status
Not open for further replies.

Tison

Programmer
May 12, 1999
216
CH
Does anyone have a clever idea on how to remove an entry from cron once a job has run ?
What I want to achieve is to schedule a job via cron and then either remove or hash it once it has run.
 
man at

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Easiest way would be to run the job once via cron and set a file (temp file). The next time the job runs from cron the script should llok for the flag and not run....then you can remove from cron at your lesure....
 


have you script remove itself when complete

add this to the bottom of your script.

crontab -l | egrep -v "myscript" > /tmp/newcron
crontab /tmp/newcron


---
 
Try using "at" - it lets you schedule a job to be run ONCE, and with a little creativity, you can have it reschedule itself so that it effectively works like cron.

Brett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top