How to run the crontab timing script and cygwincrontab script in cygwin

Source: Internet
Author: User

How to run the crontab timing script and cygwincrontab script in cygwin

When cygwin is used, it is natural that you want to handle more tasks similar to linux, and then the scheduled task crontab is indispensable. You can see a lot of online tutorials and it is not easy to run a test on your own, the following is a record of my installation process for your reference!

1. You are willing to run cygwinat first, and then click the setup.exe installation program again. You can add a faster image address when selecting here. Because there is no attachment in the built-in package, select install in the admin file to install software related to crontab. 2:

2. Install the service

    cygrunsrv -I cron -p /usr/sbin/cron -a -D

-I: Installation

Cron is the service name.

-P/usr/sbin/cron is the directory of the specified service program

-A is followed by the parameters to be added when running the service. The command for running the service here is/usr/sbin/cron-D.

3. After installing the service, run

Cygrunsrv-S cron # to start this service

4. Add a test crontab scheduled task

    crontab -e       */2 * 03 12 * /bin/ls > /cygdrive/c/Users/weiy/Desktop/ls.log    */1 * * 12 * echo "hahahaha" > /cygdrive/c/Users/weiy/Desktop/echo.log

5. View scheduled tasks

Crontab-l # view the task list cronevents # view the execution status

Note: In cygwin, you do not need to install software installed in windows to run it. For example, php-m, mysql-v ,...

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.