一、定时crontab命令:
#写当前用户crontab文件
crontab -e
0 4 * * * '/dirk.sh' >> '/dirk.log' 2>&1 &
二、tail命令:
1.要显示 notes 文件的最后十行,输入:
tail notes
2.要指定从 notes 文件末尾开始读取的行数,输入:
tail -n 20 notes
3.要从第 200 字节开始,每次显示一页 notes 文件,输入:
tail -c +200 notes | pg
4.要跟踪文件的增长,输入:
tail -f accounts
这显示 accounts 文件的最后十行。tail 命令继续显示添加到 accounts 文件中的行。显示会一直继续,直到您按下 Ctrl-C 按键顺序来停止。
三、判断上一个命令是否执行完成
if [ $? -eq 0 ]
then
echo "squid is good!"
else
echo "squid is bad!"
fi