pycronからcygwinのcronに乗り換えた
読了まで:約4分
概要: pycron から
今まで
で、
サービスとしてインストールせずに使用する方法 が載ってないので、
自分の
1. cygwin の cron をインストールする
まずは
まあsetup.exe
で
2. cygwin 上からcron-config
を実行する
で
$ cron-config
を
で、cron-config
を
$ cron-config
Do you want to install the cron daemon as a service? (yes/no) no (ここはnoを入力)
Running cron_diagnose ...
... no problem found.
Do you want to start the cron daemon as a job now? (yes/no) no (これも同じくnoを入力)
OK. Type '/usr/sbin/cron' to start the cron daemon job.
In case of problem, examine the log file for cron,
/var/log/cron.log, and the Windows event log (using /usr/bin/cronevents)
for information about the problem cron is having.
Examine also any cron.log file in the HOME directory
(or the file specified in MAILTO) and cron related files in /tmp.
If you cannot fix the problem, then report it to [email protected].
Please run the script /usr/bin/cronbug and ATTACH its output
(the file cronbug.txt) to your e-mail.
と... no problem found.
と
3. crontab
でジョブを登録する
まあ cygwin 上でのcrontab
$ crontab -e
で
* * * * * /bin/date >>/tmp/date.log 2>&1
みたいな
あと
で、
4. cron を立ち上げる bat ファイルを書く
で、
最初にcron
を
で、cron
を
#!/bin/sh
cron &
で、
set CYGDRIVE=Z:
set HOME=%CYGDRIVE%\cygwin\home\nyarla
set PATH=%CYGDRIVE%\cygwin\bin;Z:\cygwin\usr\X11R6\bin;%CYGDRIVE%\cygwin\usr\sbin
sh /cygdrive/z/backup/bin/cron.sh
で、sh
で、
- hideconsole と
いう アプリケーションを 使って、 コマンドプロンプトを 隠します。
まずhideconsole.exe
の
{hideconsoleのディレクトリ}\hideconsole.exe {cronを実行するbatファイルへのフルパス}
と
で、
で、sh
のcron
がhideconsole
で、
5. 以上終了
で、
実は
あと
まあ正直 cygwin の
良かったら
#FIXME