Linux timer (crontab) instance

Source: Internet
Author: User

Examples of Linux experiments----The implementation of "/etc" files under the "/usr/lobal" directory every 2 minutes


· Step1: Edit the current user's crontab and save
Terminal input:
>crontab-u root-l #查看root用户设置的定时器
>crontab-u root-e #进入vi编译模式

xx-2 * * * * */bin/bash/usr/local/crontab_test.sh

#Esc退出编辑模式, save by entering ": Wq" at the end of the file

· STEP2:/usr/local directory, write crontab_test.sh file

#!/bin//usr/localdd= ' date +%d ' MM= ' date +%M ' SS= ' date +%S ' backetc=  /"filebackup finished! "

· STEP3: After the file is built, enter the following command in the terminal to modify the permissions of the file
>chmod u+x crontab_test.sh

-----------

(after a few minutes, you can find more than a few *.tar.gz files by looking in the/usr/local directory!)

attached: Specific Linux under the use of crontab can refer to the "Man crontab" command!

Linux timer (crontab) instance

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.