Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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'm trying to create a cron that will run one time at a specific time.

For simplicity, how can I create a cron that will run at 11:57PM and print "Hello" to the screen then delete itself? (Cent OS 5)

share|improve this question
up vote 4 down vote accepted

If you need it to run just once, cron is not your tool.

at (1)               - queue, examine or delete jobs for later execution


# at 12:57PM
warning: commands will be executed using /bin/sh
at> echo hello
at> <EOT>
job 2 at Mon Jan  2 12:57:00 2012

(Press ctrl+d when done entering commands)

Scheduling relatively to now

fbh@pinky:~$ at now + 5 min
warning: commands will be executed using /bin/sh
at> echo moo
at> <EOT>
job 5 at Mon Jan  2 06:05:00 2012

And as always, read much more on how to use this tool in the man page for it.

share|improve this answer

If you use at, the output of the command will be emailed to you. To output text to the current terminal do the following:

echo "echo 'hello' > `tty`" | at 11:57PM
echo "echo 'hello' > `tty`" | at now + 5 minutes

Note that when you use now + x minutes, the execution time will be rounded to the previous minute.

share|improve this answer

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.