How to submit cron jobs?

How can I write a script to submit a perl script as a cron job but only have it execute once?

After it has executed once, I would like it to automatically insert itself again into cron.

I want to avoid the situation where I schedule a cron job to run once a day, but end up with multiple instances of the cron job because it requires more than 24 hours to execute.

Thanks,
Siegfried

just have your perl script check to see if it is already running. if so then don't run.

How do I check to see if it is still running?

Let is supposed I set a flag in a database and I clear the flag when the perl script exits.

What happens if the perl script access violates and executes before it clears the flag?

Then I will never run thinking I am already running!

Thanks,
Siegfried

Install a signal handler that looks for SIGINT, or whatever, and delete the file there. I don't program for a living so I can't give you expert advice there.

Put your job in a loop inside a shell script. Trap your error of your perl script in the loop. Put this shell script on cron.