Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to add a cron entry that does something like:

00 00 * * * * /tmp/script.sh

Is there something I can add to the end of the line, so that when it is finished, it will remove the line out of my cron?

Also, if there is a better way to do it, I would definitely want that information instead.

share|improve this question

1 Answer 1

up vote 12 down vote accepted

Cron is used to schedule a job to run repeatedly. What you want is at, which schedules a job to run one-time. For your example you can write:

at midnight

This will bring up an interactive prompt where you can enter /tmp/script.sh followed by Ctrl+D.

share|improve this answer
1  
Perfect! Just what I needed! –  Questionmark Mar 24 at 14:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.