Difference between revisions of "Cygwin"
From dbawiki
(→How to run a crontab in Cygwin on Windows) |
(→How to run a crontab in Cygwin on Windows) |
||
| Line 4: | Line 4: | ||
<pre> | <pre> | ||
C:\cygwin\bin\bash.exe -l -c /cygwin/path/to/shell | C:\cygwin\bin\bash.exe -l -c /cygwin/path/to/shell | ||
| − | </pre>* Install cygrunsrv and cron packages from the admin bundle (with 'Install from internet" option) | + | </pre> |
| + | '''otherwise...''' | ||
| + | * Install cygrunsrv and cron packages from the admin bundle (with 'Install from internet" option) | ||
* From a Cygwin prompt, type: | * From a Cygwin prompt, type: | ||
<pre> | <pre> | ||
Revision as of 14:58, 28 November 2014
How to run a crontab in Cygwin on Windows
Just to mention first that you could bypass cron altogether with this little trick:
Create a scheduled task with the windows scheduler by calling the shell program
C:\cygwin\bin\bash.exe -l -c /cygwin/path/to/shell
otherwise...
- Install cygrunsrv and cron packages from the admin bundle (with 'Install from internet" option)
- From a Cygwin prompt, type:
cygrunsrv --install cron --path /usr/sbin/cron --args -n
- Start the cron daemon from a Windows prompt with:
net start cron
or from a Cygwin prompt with:
cygrunsrv --start cron
Configure cron
Run this from a Cygwin terminal
cron-config
Show system log of possible problems from the cron daemon (service)
/usr/bin/cronevents
Diagnose problems
Check installed modules
cygcheck.exe -c
Check current status
cygrunsrv -Q cron
If you get
(CRON) error (can't switch user context)
this means that the cron service is trying to run jobs as the "Local System" account. Right-click on the service and change the user it runs jobs as to be the one you want.