CentOS Edit/etc/crontab Program task does not take effect.

Source: Internet
Author: User

Generally everyone will not write wrong, still others think that need reload AH or restart Crond service! But this is not the crux of the problem! Everybody writes like this:

Hours of the week the user needs to execute the command

There's nothing wrong with it.

The real reason you think the task is not implemented is that there are some places in the script that don't write absolute paths. For example

#!/bin/bash

Echo 1 >> 1.txt

So you will always see this script in the directory where there is no 1.txt file to determine if there is no execution of this script? You directly./This script way to execute, he will be in the current directory generated 1.txt but you let Crond to help you execute, this 1.txt will go where! It's not not in effect! So, remember Crontab wrote in the script to execute must write absolute path!


You can also combine cron logs to see!

Tail-n 100/var/log/cron

CentOS Edit/etc/crontab Program task does not take effect.

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.