Skip to content

Instantly share code, notes, and snippets.

@wxianfeng
Created April 13, 2012 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wxianfeng/2379012 to your computer and use it in GitHub Desktop.
Save wxianfeng/2379012 to your computer and use it in GitHub Desktop.
crontab DEMO
# edit crontab job
>crontab -e
[root@localhost shell]# crontab -l
# m h d mon dow command
0 3 * * * root /bin/sh /data/shell/scan_yuezhi.sh >> /data/shell/output.txt 2>&1 # 每天早晨3点执行
* * * * * root /bin/sh /data/shell/date.sh >> /data/shell/output.txt 2>&1 # 每分钟一次
# scan_yuezhi.sh
#!/bin/sh
cd /data/projects/project_manager/
/usr/bin/rake pm:scan_tasks RAILS_ENV=production
# date.sh
#!/bin/sh
/bin/date >> /tmp/date.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment