Crontab usage experience

Source: Internet
Author: User

Crontab usage tips 1. View crontab instructions Linux code [fwang5 @ szotautotest03 ~] $ More/etc/crontab SHELL =/bin/bash PATH =/sbin:/bin:/usr/sbin: /usr/bin MAILTO = root HOME =/# For details see man 4 crontabs # Example of job definition :#. ---------------- minute (0-59) # |. ------------- hour (0-23) # |. ---------- day of month (1-31) # |. ------- month (1-12) OR jan, feb, mar, apr... # |. ---- day of week (0-6) (Sunday = 0 or 7) OR sun, mon, tue, wed, thu, fri, sat # | # ***** User-name command to be executed 2. query the crontab service command and the current Linux code [fwang5 @ szotautotest03 ~] $ Sudo/sbin/service crond Usage:/etc/init. d/crond {start | stop | status | restart | condrestart | try-restart | reload | force-reload} [fwang5 @ szotautotest03 ~] $ Sudo/sbin/service crond status crond (pid 20109) is running... 3. view the Linux code for crontab configuration [fwang5 @ szotautotest03 ~] $ Sudo crontab-u fwang5-l 5 8 ***/home/MSDOMAIN1/fwang5/work/weblogin-monitor/loginstart. sh &>/dev/null 0 9 ***/home/MSDOMAIN1/fwang5/work/stash-user-monitor/start. sh &>/dev/null 4. edit crontab configuration (automatically enters VI editing mode) Linux code [fwang5 @ szotautotest03 ~] $ Sudo crontab-u fwang5-e 5 8 ***/home/MSDOMAIN1/fwang5/work/weblogin-monitor/loginstart. sh &>/dev/null 0 9 ***/home/MSDOMAIN1/fwang5/work/stash-user-monitor/start. sh &>/dev/null ~ ~ "/Tmp/crontab. uDsLmb" 2L, 161C 5. Delete crontab to configure Linux code [fwang5 @ szotautotest03 ~] $ Sudo crontab-u fwang5-r 6. view the crontab log Linux code [fwang5 @ szotautotest03 ~] $ Sudo tail-f/var/log/cron Apr 8 14:02:50 szotautotest03 crontab [24296]: (root) LIST (fwang5) Apr 8 14:02:56 szotautotest03 crontab [24298]: (root) begin edit (fwang5) Apr 8 14:03:57 szotautotest03 crontab [24298]: (root) REPLACE (fwang5) Apr 8 14:03:57 szotautotest03 crontab [24298]: (root) end edit (fwang5) apr 8 14:04:01 szotautotest03 crond [20109]: (fwang5) RELOAD (/var/spool/cron/fwang5) Apr 8 14:10:20 szotautotest03 crontab [24314]: (root) LIST (fwang5) apr 8 14:29:15 szotautotest03 crontab [24323]: (root) LIST (fwang5) Apr 8 14:35:53 szotautotest03 crontab [24385]: (root) LIST (fwang5) apr 8 14:36:22 szotautotest03 crontab [24387]: (root) begin edit (fwang5) Apr 8 14:37:49 szotautotest03 crontab [24387]: (root) end edit (fwang5)

Related Article

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.