Linux crontab file location and log location __linux

Source: Internet
Author: User

I. File location

Position in general under/var/spool/cron/, if you are root, then there is a root file, recommended daily backup, to avoid accidental deletion caused crontab file loss;

Two. log file location

By default, the log executed in Crontab is written under/var/log, such as:
#ls/var/log/cron*
/var/log/cron/var/log/cron.1/var/log/cron.2/var/log/cron.3/var/log/cron.4

The crontab log is simpler and sends a message to the user when a crond fails to perform a task. It happened that one of our servers found that a task was not executing correctly, and that Crond sent the mail failed. By looking at Mail's log, you see a lack of disk space.
You can add your own logs to the tasks in each crontab to help you find the reason for execution failure.
0 6 * * *//root/script/ss.sh >>/root/for_crontab/mylog.log 2>&1
The error output and standard output are exported to the MyLog.log.

If Crontab does not succeed, detect if the crontab service is started,

/etc/init.d/crond status

/etc/init.d/crond restart

Cron is the system daemon, location:
/etc/init.d/crond
Parameters:
Start
Stop
Restart
Reload
Wait a minute

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.