Automatically run scripts and scheduled tasks on Ubuntu

Source: Internet
Author: User
1. Start from running
You can modify the RC. Local file to easily process the self-running startup. This file is located under the/etc directory.
By default, RC. Local is an empty foot. You only need to modify it. Note whether the processes on which the command is executed in this file are running. I tried again because I wanted to start dia when I started it. I tried it many times but failed. I think the interface process is not started yet. My lab script is

Echo "Hello. Rc. Local"> Home/shanfeng/rc. Local: The experiment is successful.

There is also the rc *. d directory under the/etc directory. These directories are placed in many soft links of scripts under/etc/init. d/. The operating system selects to run the scripts based on different running levels. You can also modify them to start from running.

2. Scheduled task
A simple processing method is introduced.
To use cron to process scheduled tasks, you must first ensure that the cron operation has been run. If cron is installed
. Under normal circumstances, cron has been started and runs automatically, if not.
/Etc/init. d/cron start
Use crontab to schedule scheduled tasks
Crontab [-u user] {-L |-r |-e}
-L: displays tasks.
-E: edit a task.
-R: Clear the task

Task format:
Minute Hour Week month year Operation Command
Eg:
1.*14 *** echo "Look Me">/home/shanfeng/test indicates that the task runs once every day.
2. 0-59/2 *** echo "Look Me">/tmp/test indicates that the task runs every two minutes.
3. * *** echo "Look Me">/tmp/test indicates that the task runs once at and.

*: Represents any-: represents the interval./: represents the frequency,: represents the enumeration

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.