码迷,mamicode.com
首页 > 系统相关 > 详细

删除目录文件重启进程

时间:2017-11-28 11:45:45      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:bsp   read   col   bin   path   int   agent   ssi   star   

#!/bin/bash
#@author vickey
main()
{
TMP_PATH="/home/test"
echo "are you sure to del all files in test/?"
echo "y/n?: "
read answer
if [ ${answer} == "y" -o ${answer} == "Y" ]
then
        restart     
        rm -rf /home/test/*
        echo "you had del files in delete /home/test/*"
else
        echo "never mind,you didn‘t del any files"
fi
}

restart()
{
        cd $TMP_PATH
        if [ -s "${TMP_PATH}/rm_tmp.txt" ];then
                touch rm_tmp.txt
                ps -ef | grep -v grep | grep PatrolAgent >rm_tmp.txt
        else
                ps -ef | grep -v grep | grep PatrolAgent >rm_tmp.txt
        fi
        processID=`echo | cat rm_tmp.txt | awk ‘{print $2}‘`
        echo $processID
        kill -9 $processID
}
main

 

删除目录文件重启进程

标签:bsp   read   col   bin   path   int   agent   ssi   star   

原文地址:http://www.cnblogs.com/vickey-wu/p/7908320.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!