cygwin - install crontab in widows as a service

$ apt-cyg install cron
Installing cron
--2017-06-30 17:59:19--  http://mirrors.163.com/cygwin//x86_64/release/cron/cron-4.1-65.tar.xz
Resolving mirrors.163.com... 123.58.173.186, 123.58.173.185
Connecting to mirrors.163.com|123.58.173.186|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 55244 (54K) [application/octet-stream]
Saving to: 'cron-4.1-65.tar.xz'

cron-4.1-65.tar.xz                                  100%[==================================================================================================================>]  53.95K  --.-KB/s    in 0.09s

2017-06-30 17:59:19 (621 KB/s) - 'cron-4.1-65.tar.xz' saved [55244/55244]

cron-4.1-65.tar.xz: OK
Unpacking...
Package cron requires the following packages, installing:
bash coreutils cygwin editrights gawk grep sed
Package bash is already installed, skipping
Package coreutils is already installed, skipping
Package cygwin is already installed, skipping
Package editrights is already installed, skipping
Package gawk is already installed, skipping
Package grep is already installed, skipping
Package sed is already installed, skipping
Running /etc/postinstall/cron.sh
Package cron installed


$ crontab.exe
crontab: usage error: file name must be specified for replace
usage:  crontab [-u user] file
        crontab [-u user] [ -e | -l | -r ]
                (default operation is replace, per 1003.2)
        -e      (edit user's crontab)
        -l      (list user's crontab)
        -r      (delete user's crontab)


$ crontab.exe -l
no crontab for DENGBEIQUAN+dengbeiquan


$ crontab.exe -e
no crontab for DENGBEIQUAN+dengbeiquan - using an empty one
crontab: no changes made to crontab


$ ps aux | grep cro


$ ps
      PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
     5144    3748    5144       4292  pty0      197610 17:54:37 /usr/bin/bash
     6096    5144    6096       1208  pty0      197610 17:59:45 /usr/bin/ps
     3748       1    3748       3748  ?         197610 17:54:36 /usr/bin/mintty


$ ps aux \
>
      PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
     5144    3748    5144       4292  pty0      197610 17:54:37 /usr/bin/bash
     5588    5144    5588       6108  pty0      197610 17:59:51 /usr/bin/ps
     3748       1    3748       3748  ?         197610 17:54:36 /usr/bin/mintty


$ whereis crontab
crontab: /usr/bin/crontab.exe /usr/share/man/man1/crontab.1 /usr/share/man/man5/crontab.5


$ cron
-bash: cron: command not found


$ cron
cronbug         cron-config     cronevents.exe  cronlog         crontab.exe


$ cron-config
The cron daemon can run as a service or as a job. The latter is not recommended.
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
  http://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-nopasswd1
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) yes

Please enter the password for user 'DENGBEIQUAN+dengbeiquan':
Reenter:
Running cron_diagnose ...
WARNING: You do not currently have a crontab file.

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

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 cygwin@cygwin.com.
Please run the script /usr/bin/cronbug and ATTACH its output
(the file cronbug.txt) to your e-mail.

WARNING: PATH may be set differently under cron than in interactive shells.
         Names such as "find" and "date" may refer to Windows programs.



$ ps aux
      PID    PPID    PGID     WINPID   TTY         UID    STIME COMMAND
     2300    5144    2300        684  pty0      197610 18:03:54 /usr/bin/ps
     5144    3748    5144       4292  pty0      197610 17:54:37 /usr/bin/bash
     4424       1    4424       4424  ?         197610 18:02:57 /usr/bin/cygrunsrv
     5436    4424    5436       4440  ?         197610 18:02:57 /usr/sbin/cron
     3748       1    3748       3748  ?         197610 17:54:36 /usr/bin/mintty


$ crontab.exe -l
no crontab for DENGBEIQUAN+dengbeiquan

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值