workman项目设置开机自启动
2018-09-29 18:54 狼人:-) 阅读(807) 评论(0) 编辑 收藏 举报https://blog.csdn.net/xxq929604980/article/details/78558317
http://man.linuxde.net/chkconfig
1.脚本编写
1.2.脚本前三行注释是注册服务所必须的,可以改参数,设置好php安装路径,项目跟路径,启动文件即可
-
-
#chkconfig:2345 90 10
-
#description:activitytask service
-
#processname:activitytask
-
-
php=/usr/bin/php
-
root_path="/vagrant/activity_task/"
-
start_file="web_start.php"
-
case "$1" in
-
start)
-
echo 'starting activity_task web_start.php'
-
echo "$php ${root_path}${start_file} start -d"
-
$php ${root_path}${start_file} start -d
-
;;
-
stop)
-
echo "stoping activity_task...web_start.php"
-
echo "$php ${root_path}${start_file} stop"
-
$php ${root_path}${start_file} stop
-
;;
-
-
status)
-
echo "status activity_task...web_start.php"
-
echo "$php ${root_path}${start_file} status"
-
$php ${root_path}${start_file} status
-
;;
-
-
restart)
-
echo "restarting activity_task...web_start.php"
-
echo "$php ${root_path}${start_file} reload"
-
$php ${root_path}${start_file} reload
-
;;
-
*)
-
-
echo "Usage: $0 {start|stop|restart|restart}"
-
-
exit 1
-
-
;;
-
-
-
esac
1.2 配置开机自启动
1.配置文件可执行,chmod +x service_name(假设脚本文件命名为service_name)
2.设置服务的运行级别,默认2345.所以选择默认即可。
chkconfig service_name on
--------------------- 本文来自 带风带不走 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/xxq929604980/article/details/78558317?utm_source=copy
声明:此博有部分内容为转载,版权归原作者所有~