Reputation: 107
I want to run a program at specific time in every day of every week. how can I do this ? my OS is ubuntu. thanks
Upvotes: 0
Views: 63
Reputation: 63956
type crontab -e <enter>
from the command line
And then add an entry with the following format:
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
For example:
30 18 * * * rm /tmp/*
Will execute rm /tmp/*
every day at 6:30 PM
Upvotes: 0
Reputation: 364
That's called a crontab. With the command crontab -e you can add a task.
A line in the crontabfile looks like this:
* * * * * command to be executed
┬ ┬ ┬ ┬ ┬
│ │ │ │ │
│ │ │ │ │
│ │ │ │ └───── day of week (0 - 7) (0 or 7 are Sunday, or use names)
│ │ │ └────────── month (1 - 12)
│ │ └─────────────── day of month (1 - 31)
│ └──────────────────── hour (0 - 23)
└───────────────────────── min (0 - 59)
See http://en.wikipedia.org/wiki/Cron
Upvotes: 3