Ubuntu Setup Scheduled Tasks

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.