重启后有任何一个自动启动python脚本的脚本(centos)。
我试过这段代码,但它不起作用
#! /bin/sh
# chkconfig: 2345 95 20
# description: almagest
# What your script does (not sure if this is necessary though)
# processname: www-almagest
# /etc/init.d/www-almagest start
case "$1" in
start)
echo "Starting almagest"
# run application you want to start
python ~almagest_clinic/app.py &> /dev/null &
;;
stop)
echo "Stopping example"
# kill application you want to stop
kill -9 $(sudo lsof -t -i:8002)
;;
*)
echo "Usage: /etc/init.d/www-private{start|stop}"
exit 1
;;
esac
exit 0
chkconfig 脚本打开
最佳答案
我找到了解决方案 https://github.com/frdmn/service-daemons/blob/master/centos 绝对路径对我有用
关于python - 重启后 init.d 自动启动 python 脚本 (Centos),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22291908/