由于配置有限,需要定制执行某些命令清理结束进程,搜了一下。
https://www.cnblogs.com/shujuxiong/p/9023254.html
#!/bin/sh
#Section configuration(配置部分)
#Task Time ,example:203000(Time 20:30:00);190000(Time 19:00:00);
startTime=113200
#the programs you want to execute(要执行的程序)
program=ps
#Section promgram (程序执行部分)
perDate=$(date "+%Y%m%d")
isNewDay=1
isFirstTime=1
echo 'Task schedule Time: ('$startTime') program: ('$program') Waiting...'
while true ; do
curTime=$(date "+%H%M%S")
curDate=$(date "+%Y%m%d")
#Check week day(周末不执行)
week=`date +%w`
if [ $week -eq 6 ] || [ $week -eq 0 ];then
isNewDay=0
sleep 1
continue
else
#check and run script(工作日执行)
if [ "$isNewDay" -eq "1" ];then
if [ "$curTime" -gt "$startTime" ];then
if [ "$isFirstTime" -eq "0" ];then
echo 'The program ('$program') Running...'
$program
echo 'The program ('$program') Stopped...'
fi
isNewDay=0
else
if [ "$isFirstTime" -eq "1" ];then
echo 'New Day: ('$curDate') Task schedule Time: ('$startTime') Waiting...'
isFirstTime=0
fi
fi
else
#new day start(开始新的一天)
if [ "$curDate" -gt "$perDate" ];then
echo 'New Day: ('$curDate') Task schedule Time: ('$startTime') Waiting...'
isNewDay=1
perDate=$curDate
fi
fi
sleep 1
fi
done
很好。
但是,需要动态的读取文件内容。于是乎,看到了这个:
https://blog.csdn.net/sidely/article/details/40426999
var=$(cat name.txt)
好的。vim, ESC, Ctrl +S 卡死了。
习惯了。。。
https://blog.csdn.net/u014726937/article/details/51151899
ssh vim中不小心按下ctrl+s
由于windows使用习惯, 经常会一不小心在ssh vim里面按下了ctrl+s… 然后整个shell就挂掉了.
以前都是强制结束的, google了一下, 发现原来按ctrl+q就可以了
ctrl+s是”阻断向终端输出”
ctrl+q是”恢复向终端输出”
ctrl+c
ctrl+z
老板再也不用担心我的服务器卡成了
记录一下下。