質問

一部のcygwinコマンド .exe ファイルできますので実行して標準のWindowsのスケジューラー、その他をお持ちでない .exe 延長を実行できないからDOS(うする必要があります。

例えばたい updatedb 実行が毎晩行われます。

くの、めんどくさいんだよなcronす。

役に立ちましたか?

解決

あなたはcygrunsrvを実行し、Windowsサービスとしてのcronを設定することができるようにもcron-configをインストールする必要があります。

あなたが任意の出力の電子メールを送信するためにcronジョブをしたい場合は、

あなたもeximまたはssmtpのいずれかをインストールする必要があります(cron-configを実行する前に。)

詳細は/usr/share/doc/Cygwin/cron-*.READMEを参照してください。

.exe拡張子なしのプログラムについては、彼らはおそらく、いくつかのタイプのシェルスクリプトです。あなたは、ファイルの最初の行を見ると、あなたが(例えば、「#!/bin/sh」)それらを実行するために使用するために必要なものをプログラム見ることができるので、あなたは、おそらくシェルプログラム(例えば、「C:\cygwin\bin\sh.exe -l /my/cygwin/path/to/progを呼び出すことによって、Windowsのスケジューラからそれらを実行することができます」。)

他のヒント

いつのオプション:

  1. イcronとして、windowsサービスを利用cygrunsrv:

    cygrunsrv -I cron -p /usr/sbin/cron -a -n
    
    net start cron
    

    ご注意く)の古いバージョンのcronを使用する必要があり-Dの代わりに-n

  2. の体.exe'ファイルもbashのスクリプトで実行して、windowsのスケジューラを呼び出すことによりbashにスクリプトを実行し、例えば:

    C:\cygwin\bin\bash.exe -l -c "./full-path/to/script.sh"
    

帽子の先端 http://linux.subogero.com/894/cron-on-cygwin/

開始のcygwinセットアップメモリの使用範囲のサイズは"d"のパッケージからは、"Admin"です。

まcron実行してサービスのユーザーによるシステム。貧しいシステムが必要とホームディレクトリとしています。を"/etc/passwdファイルを定義します。

$ mkdir /root
$ chown SYSTEM:root /root
$ mcedit /etc/passwd
SYSTEM:*:......:/root:/bin/bash

の開始のサービス:

$ cron-config
Do you want to remove or reinstall it (yes/no) yes
Do you want to install the cron daemon as a service? (yes/no) yes
Enter the value of CYGWIN for the daemon: [ ] ntsec
Do you want the cron daemon to run as yourself? (yes/no) no
Do you want to start the cron daemon as a service now? (yes/no) yes

地元のユーザー で定義予定のような仕事をするようになったことです(crontab開お気に入りのエディタ):

$ crontab -e  # edit your user specific cron-table HOME=/home/foo
PATH=/usr/local/bin:/usr/bin:/bin:$PATH
# testing - one per line
* * * * *   touch ~/cron
@reboot     ~/foo.sh
45 11 * * * ~/lunch_message_to_mates.sh

ドメインのユーザー:したら動かなかったのですが。貧しいcronができなくなっ予定業務代行のドメインのユーザーの機です。がもう一つの方法があり:cronまた、システムレベルのソテーブル"/etc/crontab".ですのsuffあり、そのシステムなので、自分の代わり:

$ touch /etc/crontab
$ chown SYSTEM /etc/crontab
$ mcedit /etc/crontab
HOME=/root
PATH=/usr/local/bin:/usr/bin:/bin:$PATH
* * * * *   SYSTEM touch ~/cron
@reboot     SYSTEM rm -f /tmp/.ssh*

たつのcrontabのための助言を行います。さらに環境設定や予定しています。以上のように、Cygwinで作成可能。ホームdirシェルは、通常は"/etc/passwd".

としてのカラムの予定コマンドの取扱説明書をご覧ください。

あcrontab作を実行しませんの診断ツールです:

$ cronevents

ただのcronのオプションが変更されているように見えることを追加したいです。 -Dのではなく、-n渡す必要があります。

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

用からの指示を受け この答え くことになってい けによりコピーペーストのような回答がcygwinインストールインストール手順はどの抗コピー-ペースト的に実施)
をクリックしWinLogoボタンタイプcmd.exe 右クリックで選ぶ"スタートとして管理者"です。に cmd 迅速:

 cd <directory_where_i_forgot_the setup-x86_64.exe> cygwin installer:
 set package_name=cygrunsrv cron
 setup-x86_64.exe -n -q -s http://cygwin.mirror.constant.com -P %package_name%

をインストーラを起動せずに捨てる誤差のために、迅速かつ的確に...場合にはおいcygwin連星走りやすいWindowsの管理、または一部の掲示板バ...

現在 cmd promt:

 C:\cygwin64\bin\cygrunsrv.exe -I cron -p /usr/sbin/cron -a -D   

などのフルファイルパスなければならなくなるかもしれのcygrunsrv.exe や 始めにcronとしてのwindowsサービスの迅速なcmd

 net start cron

現在 bash 端末の実行 crontab-e

設定すcronの入力例を以下:

        #sync my gdrive each 10th minute
    */10 * * * * /home/Yordan/sync_gdrive.sh

    # * * * * * command to be executed
    # - - - - -
    # | | | | |
    # | | | | +- - - - day of week (0 - 6) (Sunday=0)
    # | | | +- - - - - month (1 - 12)
    # | | +- - - - - - day of month (1 - 31)
    # | +- - - - - - - hour (0 - 23)
    # +--------------- minute
私は、Windows 7にログオンしたときに

私はここで私のために働いたものだ、自動的に実行されているCygwinのcronサービスを取得する方法を考え出します:

メモ帳は、(引用符)は、第2行の最初の行とC:\cygwin\bin\Cygwin_launch_crontab_service_input.txt上のコンテンツnoでファイルyesを作成し使用します。これらはcron-configの入力を促しためにあなたの2つの応答されます。

コンテンツとファイルC:\cygwin\Cygwin_launch_crontab_service.batを作成します:

@echo off
C:
chdir C:\cygwin\bin
bash  cron-config < Cygwin_launch_crontab_service_input.txt

Windowsのスタートアップフォルダに次のショートカットを追加します。 Cygwin_launch_crontab_service.bat

http://www.sevenforums.com/tutorials/1401を参照してください。 -startup-プログラム-change.html のあなたがスタートアップに追加する方法についてのヘルプが必要な場合。あなたが好きならばところで、あなたは、必要に応じて、スタートアップにこれらを追加することができます:

Cygwinの

XWINサーバー

最初の実行

C:\cygwin\Cygwin.bat

2つ目が実行

C:\cygwin\bin\run.exe /usr/bin/bash.exe -l -c /usr/bin/startxwin.exe

正しい書式設置 cron cygwinとしてのWindowsサービスの通 -n 引数として与えた場合、そのな -D:

cygrunsrv--install cron--パスが/usr/sbin/cron--(<%=args%>等:args -n

-D を返します利用の誤りを開始する場合 cron cygwin:

$

$cygrunsrv--install cron--パスが/usr/sbin/cron--(<%=args%>等:args-D

$cygrunsrv--開始cron

cygrunsrv:エラーを始め、サービス:QueryServiceStatus:Win32エラー1062:

サービスは開始されました。

$rock/モノクロ/ねこ/海/var/log/cron.ログ

cron:未知のオプション-D

使用量:/usr/sbin/cron[-n][-x[ext紙,パルク、負荷、その他、試験、ビット]]

$

以下のページをいいます。

ト&設定Cygwin Cronサービス窓:https://www.davidjnice.com/cygwin_cron_service.html

P.S. た行 Cygwin64端子 私のWindows10PCに管理者権限でインストール cron Windowsサービスです。

Getting updatedb to work in cron on Cygwin -- debugging steps
1) Make sure cron is installed.
 a) Type 'cron' tab tab and look for completion help.
   You should see crontab.exe, cron-config, etc.  If not install cron using setup.
2) Run cron-config.  Be sure to read all the ways to diagnose cron.
3) Run crontab -e
 a) Create a test entry of something simple, e.g.,
   "* * * * * echo $HOME >> /tmp/mycron.log" and save it.
4) cat /tmp/mycron.log.  Does it show cron environment variable HOME
   every minute?
5) Is HOME correct?  By default mine was /home/myusername; not what I wanted.
   So, I added the entry
   "HOME='/cygdrive/c/documents and settings/myusername'" to crontab.
6) Once assured the test entry works I moved on to 'updatedb' by
   adding an entry in crontab.
7) Since updatedb is a script, errors of sed and find showed up in
   my cron.log file.  In the error line, the absolute path of sed referenced
   an old version of sed.exe and not the one in /usr/bin.  I tried changing my
   cron PATH environment variable but because it was so long crontab
   considered the (otherwise valid) change to be an error.  I tried an
   explicit much-shorter PATH command, including what I thought were the essential
   WINDOWS paths but my cron.log file was empty.  Eventually I left PATH alone and
   replaced the old sed.exe in the other path with sed.exe from /usr/bin.
   After that updatedb ran to completion.  To reduce the number of
   permission error lines I eventually ended up with this:
   "# Run updatedb at 2:10am once per day skipping Sat and Sun'
   "10 2  *  *  1-5  /usr/bin/updatedb --localpaths='/cygdrive/c' --prunepaths='/cygdrive/c/WINDOWS'"

Notes: I ran cron-config several times throughout this process
       to restart the cygwin cron daemon.
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top