开发机上的smarty编译后的缓存文件存在总干扰开发,每次手动删除又麻烦,于是写了一个守护进程每隔6秒去删一次。



        Options:
                start - Start the daemon
                stop - Stop daemon
                status - show the delSmartyCache daemon
                help - Show help

EOF;
}

function show_status()
{
        if(file_exists(PID_PATH))
        {
                $fp = fopen(PID_PATH, 'r');
                $pid = fread($fp, 10);
                $ret = posix_kill($pid, 0);
                if($ret === true)
                {
                        echo "process delSmartyCache is alive\n";
                        exit;
                }else
                {
                        echo "process delSmartyCache is down\nplease start the process\n";
                        exit;
                }
        }else
        {
                echo "pid file not exists\n";
                exit;
        }

}