Linux定时shell脚本
2015-07-12 00:33
507 查看
明天星期天,不对,应该说今天,有一个要11点处理的事情,星期天嘛,当然是想好好休息一下,睡个懒觉了。所以写了一个简单的脚本,来完成任务。
刚好有时间,顺便记录一下:
1.编写shell脚本
vi /root/sh/crond.sh
脚本内容:
#!/bin/sh
cd /root/task/bin/
./stop.sh
2.修改权限
chmod +x /root/sh/crond.sh
3.增加/etc/crontab
0 11 12 7 * root /root/sh/crond.sh
格式说明如下:
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
4.重启crond服务
/etc/init.d/crond restart
5.查看脚本执行情况
/var/spool/mail/root
刚好有时间,顺便记录一下:
1.编写shell脚本
vi /root/sh/crond.sh
脚本内容:
#!/bin/sh
cd /root/task/bin/
./stop.sh
2.修改权限
chmod +x /root/sh/crond.sh
3.增加/etc/crontab
0 11 12 7 * root /root/sh/crond.sh
格式说明如下:
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
4.重启crond服务
/etc/init.d/crond restart
5.查看脚本执行情况
/var/spool/mail/root
相关文章推荐
- GIT---看我一步步入门(Windows Git Bash)
- Linux CentOS下shell显示-bash-4.1$不显示用户名路径
- linux下shell显示-bash-4.1#不显示路径解决方法
- shell中的点命令与source命令
- shell 入门教程
- 认识shell
- Bash启动脚本
- shell脚本
- shell中$0,$?,$!等的特殊用法
- cubieboard3的android系统用adb shell链接
- Linux Shell 数字计算与比较
- .bash_profile和.bashrc的什么区别
- xshell 配色方案 ubuntu solarized-Dark isayme
- bash之流程控制for循环及bash命令退出和退出状态码
- Linux下为可执行shell脚本文件(.sh),制作桌面启动快捷方式
- shell编程技术之-基础知识
- [Ubuntu--Shell]yum和apt-get的用法与区别
- [Ubuntu--Shell]ubuntu下一些压缩文件格式的解压与压缩
- shell排序
- shell入门之函数应用