#!/bin/bash
pidpath=/tmp/a.pid
if [ -f "$pidpath" ];then
kill $(cat $pidpath)>/dev/null 2>&1
rm -rf $pidpath
fi
echo $$>$pidpath
sleep 100
pid file
原文:http://caimengzhi.blog.51cto.com/9787265/1897801