Centos7.X等设置workman自启动shell脚本代码

1.脚本编写
1.2.脚本前三行注释是注册服务所必须的,可以改参数,设置好php安装路径,项目跟路径,启动文件即可
#!/bin/bash
#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  

上一篇: 无需第三方软件,Mac下给iPhone手机设备轻松录屏
下一篇: php实现压缩裁剪png图片功能

目前还没有人评论,您发表点看法?
发表评论

评论内容 (必填):