Linux – 自启动程序脚本

http://beself.top/2018/10/25/linux-shell-startup-self/

# Monitor Collector is running
# 此脚本是检测另外一个程序是否正在运行,如果没有运行则启动该程序

Path='PortableCollector'

while test "1"="1";do
	Result=`pgrep $Path`
	if [ ! $Result];then
                # 启动程序
		/home/default/Collector/PortableCollector -qws  
		echo "Not Running"
		echo $Result
	else
		echo "Running"
		echo $Result
	fi
        # 每次休眠1s
	sleep 1
done

猜你喜欢

转载自blog.csdn.net/ALONE_WORK/article/details/83383218