1,编写sh脚本:rm_wk.sh
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
kill -9 $(ps -ef | grep kdevtmpfsi| grep -v grep | awk '{print $2}')
kill -9 $(ps -ef | grep kinsing| grep -v grep | awk '{print $2}')
rm -rf /tmp/kdevtmpfsi
rm -rf /var/tmp/kinsing
echo "----------------------------------------------------------------------------"
endDate=`date +"%Y-%m-%d %H:%M:%S"`
echo "★[$endDate] Successful"
echo "----------------------------------------------------------------------------"
2. 建立crontab ,一分钟执行一次:
crontab -e
*/1 * * * * nohup bash -x /home/rm_wk.sh