exe_dir=/home/tenpo
tmpfilename="tmp$$"
runningflag="x"
is_running()
{
if [ $runningflag = "x" ]
then
rm -f $exe_dir/running.*
`touch "$exe_dir/running.$tmpfilename"`
else
if [ ! -f "$exe_dir/running.$tmpfilename" ]
then
exit 0
fi
return
fi
runningflag="v"
}
for f in `ls`
do
is_running
do something 如果有多个进程同时运行的话,就会重复处理
rm -f $f
done