linux写一个计划脚本每月1号3点重启服务区
Posted stillstep
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux写一个计划脚本每月1号3点重启服务区相关的知识,希望对你有一定的参考价值。
1.
每周一,三,五的下午3:00系统进入维护状态,重新启动系统。
00 15 * *1,3,5 shutdown -r +5
2.
~/tmp/restart.sh:
date
cd
/var/test
pid=`
ps
-e|
grep
test
|
grep
-
v
grep
|
awk
‘print $1‘
`
kill
-15 $pid
sleep
2
.
/test
.
/test
.lua
echo
"restart end, return $?, `date`"
让crontab来调用
crontab -e
* 3 1 * * sh ~/tmp/restart.sh
每周一,三,五的下午3:00系统进入维护状态,重新启动系统。
00 15 * *1,3,5 shutdown -r +5
定时任务含义:
每天的下午4点、5点、6点的5 min、15 min、25 min、35 min、45 min、55 min时执行命令。
5,15,25,35,45,55 16,17,18 * * * command
每周一,三,五的下午3:00系统进入维护状态,重新启动系统。
00 15 * *1,3,5 shutdown -r +5
1日早上4点
0 4 1 1 * command line
每小时(第一分钟)执行/etc/cron.hourly内的脚本
01 * * * * root run-parts /etc/cron.hourly
以上是关于linux写一个计划脚本每月1号3点重启服务区的主要内容,如果未能解决你的问题,请参考以下文章