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

workman项目设置开机自启动的更多相关文章

  1. Fedora 16设置开机自启动程序与Ubuntu的区别

    Ubuntu设置开机自启动脚本的方法是:修改/etc/init.d/rc.local这个文件,添加需要启动的程序即可,相关函数如下: void SetSysAutoBoot() { ] = {}; ; ...

  2. linux_设置开机自启动程序脚本

    设置开机自启动

  3. Linux服务器,服务管理--systemctl命令详解,设置开机自启动

    Linux服务器,服务管理--systemctl命令详解,设置开机自启动 syetemclt就是service和chkconfig这两个命令的整合,在CentOS 7就开始被使用了. 摘要: syst ...

  4. CentOS 6下 Oracle11gR2 设置开机自启动

    [1] 更改/etc/oratab # This file is used by ORACLE utilities. It is created by root.sh # and updated by ...

  5. Ubuntu14.04设置开机自启动脚本

    方法一.编辑rc.loacl脚本  Ubuntu开机之后会执行/etc/rc.local文件中的脚本,所以我们可以直接在/etc/rc.local中添加启动脚本.在 exit 0 前面添加好脚本代码, ...

  6. 设置开机自启动VirtualBox虚拟机系统

    如果常用VirtualBox虚拟机系统的话,设置个随开机启动也是很方便的.不需要打开VirtualBox窗口,直接就是系统启动了. 又继续上网搜索学习了.(设置开机自启动VirtualBox虚拟机系统 ...

  7. CentOS7设置开机自启动命令大全

    任务 旧指令 新指令 使某服务自动启动 chkconfig --level 3 httpd  on              systemctl enable httpd.service 使某服务不自 ...

  8. ntp服务设置开机自启动失败

    设置了ntpd开机自启动,重启服务器ntpd没有自启动 1.需要禁掉chronyd.service: systemctl disable chronyd.service 2.手动启动ntpd: sys ...

  9. CentOS7设置开机自启动方式

    方式一: # 在/etc/rc.d/rc.local文件中追加启动命令,该文件追加后,会随着机器自动后,自动运行文件中的命令 # vim /etc/rc.d/rc.local # 权限问题:在cent ...

随机推荐

  1. xml序列化与反序列化工具

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...

  2. 强化学习-时序差分算法(TD)和SARAS法

    1. 前言 我们前面介绍了第一个Model Free的模型蒙特卡洛算法.蒙特卡罗法在估计价值时使用了完整序列的长期回报.而且蒙特卡洛法有较大的方差,模型不是很稳定.本节我们介绍时序差分法,时序差分法不 ...

  3. 不同语言的水仙花性能比较【Test1W】

    看了大佬@鱼丸粗面一碗的文章:<这段代码,c 1秒,java 9秒,c# 14秒,而python...>,基于水仙花数的各种语言1W次性能比较,觉得很有意思.于是开启cv大法,把我有环境的 ...

  4. 关于Retrofit网络请求URL中含有可变参数的处理

    开题:在此默认各位看官对Retrofit.以及Okhttp已经有过一定的了解及应用,所以今天我们不谈基础入门的东西,今天我们谈在Retrofit请求接口管理类中URL参数含有动态参数的处理方式.一般我 ...

  5. 循环神经网络(Recurrent Neural Networks, RNN)介绍

    目录 1 什么是RNNs 2 RNNs能干什么 2.1 语言模型与文本生成Language Modeling and Generating Text 2.2 机器翻译Machine Translati ...

  6. 解决importerror no module named mysqldb

    在window中 1:在Scripts文件夹下会出现一系列和pip有关的文件,DOS中到Scripts,运行:pip install mysql-python 2:报错:Microsoft Visua ...

  7. windows 10 更新补丁包

    http://www.catalog.update.microsoft.com/Search.aspx?q=windows%2010%20prohttp://www.catalog.update.mi ...

  8. MySql 查询银行卡号打码

    ),")) end as card_number from das.staff_base; case 函数 CASE    WHEN 条件1 THEN 结果1    WHEN 条件2 THE ...

  9. 下载m3u8视频

    分两种情况 同时支持m3u8和mp4文件 某些视频同时支持m3u8和mp4视频文件,将m3u8改成mp4后直接: wget -c http://www.xxx.com/xxxx.mp4 只有m3u8视 ...

  10. 给table加边框的样式

    <style> .tb { width: 1600px; text-align: center; border-collapse: collapse; } .tb tr td { bord ...