- sh脚本
#!/bin/sh
echo "startjava.sh"if ps -ef |grep scanConfig1.jar |grep -v grep; then
echo "scanConfig1 is running"
else
echo "start java scanConfig1 ......"
su - root -c "java -jar /run/scanConfig1/scanConfig1.jar &"
echo "............................"
fi
- crontab配置
crontab -e
* * * * * su - root -c "/run/startJava.sh;"
service crond restart