我正在运行Ubuntu 10.04(64位)并在/etc/cron.hourly中有以下脚本
原文链接:https://www.f2er.com/ubuntu/348462.htmlcd /home/chris/path/to/directory git add . git commit -m "Commit message" git push origin master
该文件是775,我可以手动运行它运行脚本,并查看它推送到的服务器上的提交.这是手动运行的输出:
chris@IronHide:~$/etc/cron.hourly/auto-commit [master 8dc5299] Commit message 4 files changed,8 insertions(+),6 deletions(-) rewrite 1h/1m/c.-b.-6.dat (100%) Counting objects: 17,done. Compressing objects: 100% (7/7),done. Writing objects: 100% (9/9),4.64 KiB,done. Total 9 (delta 3),reused 0 (delta 0) To <repo_path_cencored>.git 6c6d0ad..8dc5299 master -> master
不知道是否重要,但我的/ etc / crontab文件如下所示:
# /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields,# that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) #
我究竟做错了什么?