您的位置:首页 > 其它

workman项目设置开机自启动

2018-09-29 18:54 465 查看

https://blog.csdn.net/xxq929604980/article/details/78558317

http://man.linuxde.net/chkconfig

1.脚本编写

1.2.脚本前三行注释是注册服务所必须的,可以改参数,设置好php安装路径,项目跟路径,启动文件即可

  1.   #!/bin/bash
  2.   #chkconfig:2345 90 10
  3.   #description:activitytask service
  4.   #processname:activitytask
  5.    
  6.   php=/usr/bin/php
  7.   root_path="/vagrant/activity_task/"
  8.   start_file="web_start.php"
  9.   case "$1" in
  10.   start)
  11.   echo 'starting activity_task web_start.php'
  12.   echo "$php ${root_path}${start_file} start -d"
  13.   $php ${root_path}${start_file} start -d
  14.   ;;
  15.   stop)
  16.   echo "stoping activity_task...web_start.php"
  17.   echo "$php ${root_path}${start_file} stop"
  18.   $php ${root_path}${start_file} stop
  19.   ;;
  20.    
  21.   status)
  22.   echo "status activity_task...web_start.php"
  23.   echo "$php ${root_path}${start_file} status"
  24.   $php ${root_path}${start_file} status
  25.   ;;
  26.    
  27.   restart)
  28.   echo "restarting activity_task...web_start.php"
  29.   echo "$php ${root_path}${start_file} reload"
  30.   $php ${root_path}${start_file} reload
  31.   ;;
  32.   *)
  33.    
  34.   echo "Usage: $0 {start|stop|restart|restart}"
  35.    
  36.   exit 1
  37.    
  38.   ;;
  39.    
  40.    
  41.   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 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: