Cygwinでcronを使うときのメモ その2


Cygwinでcronを使うときのメモ - XXXannex


$ cronevents | tail
2015/07/17 12:14:01 [SYSTEM] /usr/sbin/cron: PID 5676: (k) CMD (/usr/bin/echo aa)
2015/07/17 12:14:01 [SYSTEM] /usr/sbin/cron: PID 5676: (CRON) error (can't switch user context)

詳細はよく分からないけど、passwd -R でパスワードをレジストリに保存しておいて、"Do you want the cron daemon to run as yourself?" の質問は "no" で答えると良いみたい。

$ passwd -R
This functionality stores a password in the registry for usage by services
which need to change the user context and require network access.  Typical
applications are interactive remote logons using sshd, cron task, etc.
This password will always tried first when any privileged application is
about to switch the user context.

Note that storing even obfuscated passwords in the registry is not overly
secure.  Use this feature only if the machine is adequately locked down.
Don't use this feature if you don't need network access within a remote

You can delete the stored password by specifying an empty password.

Enter your current password:
Re-enter your current password:
$ cron-config
The cron daemon can run as a service or as a job. The latter is not recommended.
Cron is already installed as a service under account LocalSystem.
Do you want to remove or reinstall it? (yes/no) yes
OK. The cron service was removed.

Do you want to install the cron daemon as a service? (yes/no) yes
Enter the value of CYGWIN for the daemon: [ ]

You must decide under what account the cron daemon will run.
If you are the only user on this machine, the daemon can run as yourself.
   This gives access to all network drives but only allows you as user.
To run multiple users, cron must change user context without knowing
  the passwords. There are three methods to do that, as explained in
If all the cron users have executed "passwd -R" (see man passwd),
  which provides access to network drives, or if you are using the
  cyglsa package, then cron should run under the local system account.
Otherwise you need to have or to create a privileged account.
  This script will help you do so.
Do you want the cron daemon to run as yourself? (yes/no) no

Were the passwords of all cron users saved with "passwd -R", or
are you using the cyglsa package ? (yes/no) yes
The cron daemon will run as SYSTEM.

Running cron_diagnose ...
... no problem found.

Do you want to start the cron daemon as a service now? (yes/no) yes
OK. The cron daemon is now running.