Very simple:
Crontab-e
The following is my execution process, enter the command, will let me choose an editor, I choose 2, because the back is written easiest, the simplest.
[Email protected]:/$ crontab- for Liuyx- using a empty oneselect an editor. ' Select-editor ' . 1./bin/Ed 2./bin/nano <---- easiest 3./ usr/bin/Vim.tiny
1-3 [22crontab:installing new crontab
After selecting 2, you will enter a text editing state, where you can configure the tasks you want to perform by following the prompts:
For example, my configuration:
# Edit ThisfileTo introduce tasks to being run by cron.# # Each task to run have to is defined through a single line# indicating with Di Fferent fields when the task is run# and what command to run forThe task# # to define the TimeYou can provide concrete values for# Minute (M), hour (h), Day of Month (DOM), month (Mon), # and day of Week (DOW) or use'*' inchThese fields ( for ' any'). # # Notice that tasks would be started based on the cron's System# daemon's notion of time and timezones.# Output of the crontab jobs (including errors) is sent through# e-mail to the user the crontabfilebelongs to (unless redirected). #-Example, you can run a backup of all your user accounts# at5a.m. every week with:#0 5* *1 Tar-zcf/var/backups/home.tgz/home/# # for Moreinformation see the manual pages of crontab (5) and Cron (8) # # m H Dom Mon Dow command* * * * * * Java-jar/home/liuyx/refreship/refreship.jar
Only the last line I wrote, my task meant to execute this jar package every minute. Five * represents the time rule, and the back is the command to execute. Command This needless to say, write what you want to do. The time rule is to follow the cron expression, see the syntax for cron expressions.
After configuring these, remember to perform the following:
sudo service cron restart
For your configuration to take effect.
Complete.
You can also refer to this: https://help.ubuntu.com/community/CronHowto
Ubuntu Setup Scheduled Tasks