#!/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