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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
Perfect! Just what I needed! – Questionmark Mar 24 '14 at 14:47

Your Answer


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.