liunx crontab定时任务

墨蓝 2021-09-26 09:26 329阅读 0赞
  1. /sbin/service crond start //启动服务
  2. /sbin/service crond stop //关闭服务
  3. /sbin/service crond restart //重启服务
  4. /sbin/service crond reload //重新载入配置
  5. $ crontab -e 添加 (用户)
  6. $ crontab -l 查看服务
  7. chmod 777 filename 赋予全部权限
  8. /etc/init.d/crond restart 重启服务
  9. rsync -av meididi/ /soft/tomcat7/webapps/meididi 更新项目
  10. service mysqld restart 重启mysql
  11. /etc/rc.d/init.d/mysql stop 停止mysql
  12. /etc/rc.d/init.d/mysql start 启动mysql
  13. tar -zxvf **.tar.gz搜索 可加-C 命令指定解压目录
  14. SHELL=/bin/bash
  15. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  16. MAILTO=root
  17. HOME=/
  18. # For details see man 4 crontabs
  19. # Example of job definition:
  20. # .---------------- minute (0 - 59)
  21. # | .------------- hour (0 - 23)
  22. # | | .---------- day of month (1 - 31)
  23. # | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
  24. # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
  25. # | | | | |
  26. # * * * * * sleep 10; echo "Have a good dream:)" >> /tmp/test.txt
  27. 45 14 * * * /bin/sh /root/dstj.sh >> /root/mysqldata/dstj.log 2>&1
  28. 59 23 6 * * /bin/sh /root/hhh.sh
  29. 45 14 * * * /bin/sh /root/mysqlbak.sh >> /root/mysqldata/mysqlbak.log 2>&1
  30. 10 11 7 12 * /bin/sh /root/myhhh.sh #10分11小时7号12月执行

发表评论

表情:
评论列表 (有 0 条评论,329人围观)

还没有评论,来说两句吧...

相关阅读

    相关 crontab 定时任务

    过crontab 命令,我们可以在固定的间隔时间执行指定的系统指令或 shell script脚本。时间间隔的单位可以是分钟、小时、日、月、周及以上的任意组合。这个命令非...

    相关 Linux-Crontab定时任务

    1.介绍 crond是linux下用来周期性的执行某种任务或等待处理某些事件的一个守护进程,与windows下的计划任务类似,当安装完成操作系统后,默认会安装此服务工具,并

    相关 crontab定时任务

    一、用途 定时运行一个shell或者Linux脚本(可能还有其他的用途 暂时介绍这个) 二、如何用? a.在linux中 输入命令  crontab -e   执行之后