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 ,...