1、在/usr/lib/systemd/system/下创建服务脚本xxx.service,格式如下:

[Unit]

Description=Scrapyd

After=syslog.target netword.target

[Service] Type=forking ExecStart=/bin/sh /root/scrapyd/scrapyd.sh start ExecStop=/bin/sh /root/scrapyd/scrapyd.sh stop ExecReload=/bin/sh /root/scrapyd/scrapyd.sh reload PrivateTmp=True [Install] WantedBy=multi-user.target

注:服务里面的ExecStart、ExecStop、ExecReload需要改成相应的服务的启动,关闭,重启的指令

2.重启服务

systemctl daemon-reload  # 新增脚本,重启systemctl

systemctl start xxx.service  # 立即启动

systemctl enable xxx.service  # 设置开启启动

Centos7 添加开机启动服务的更多相关文章

  1. CentOS7添加开机启动服务/脚本(延用CentOS6方法)

    一.添加开机自启服务 在centos7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务为 ...

  2. CentOS7添加开机启动服务或脚本

    方法一(rc.local) 改方式配置自动启动最为简单,只需要修改rc.local文件 由于在centos7中/etc/rc.d/rc.local的权限被降低了,所以需要赋予其可执行权 chmod + ...

  3. (转) CentOS 7添加开机启动服务/脚本

    CentOS 7添加开机启动服务/脚本 原文:http://blog.csdn.net/wang123459/article/details/79063703 一.添加开机自启服务 在CentOS 7 ...

  4. centos7之添加开机启动服务/脚本

    一.添加开机启动脚本 #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to ...

  5. linux chkconfig添加开机启动服务

    --add:增加所指定的系统服务,让chkconfig指令得以管理它,并同时在系统启动的叙述文件内增加相关数据: --del:删除所指定的系统服务,不再由chkconfig指令管理,并同时在系统启动的 ...

  6. ubuntu 添加开机启动服务

    新建umpserver.service [Unit] Description=UMPServer After=syslog.target network.target remote-fs.target ...

  7. 【centos7】添加开机启动服务/脚本

    一.添加开机自启服务 在centos7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务为 ...

  8. centos7如何添加开机启动服务/脚本

    一.添加开机自启服务 在centos7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例): systemctl enable jenkins.service #设置jenkins服务为 ...

  9. CentOS 7添加开机启动服务/脚本

    一.添加开机自启服务 在CentOS 7中添加开机自启服务非常方便,只需要两条命令(以 jenkins 为例):systemctl enable jenkins.service #设置jenkins服 ...

随机推荐

  1. CF812C Sagheer and Nubian Market 二分+贪心

    模拟赛给他们出T1好了~ code: #include <bits/stdc++.h> #define ll long long #define N 100006 #define setI ...

  2. setsockopt函数

    #include <sys/socket.h>     int setsockopt( int socket, int level, int option_name,            ...

  3. CF915E 动态开线段树

    CF915E 动态开线段树 题面 因为\(n\le10^9\),所以动态开点,线段树维护\([1,n]\)天非工作日数量. 之前的结构体写法被卡了,只能改成函数传l,r(虽然也不难) 动态开点好写,但 ...

  4. Spoj Query on a tree SPOJ - QTREE(树链剖分+线段树)

    You are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, ...

  5. 【线性代数】7-3:对角化和伪逆(Diagonalization and the Pseudoinverse)

    title: [线性代数]7-3:对角化和伪逆(Diagonalization and the Pseudoinverse) categories: Mathematic Linear Algebra ...

  6. openpyxl模块(excel操作)

    openpyxl模块介绍 openpyxl模块是一个读写Excel 2010文档的Python库,如果要处理更早格式的Excel文档,需要用到额外的库,openpyxl是一个比较综合的工具,能够同时读 ...

  7. spring+mybatis事务的readonly属性无效

    在Spring配置事务中设置的read-only="true"不起作用,仍可以执行写操作:但是其他的正常.查看了一下DataSourceTransactionManager这个类的 ...

  8. 缓存-redis+memCache

    缓存-redis+memCache:为方便预览,将思维导图上传至印象笔记,博客园直接上传图片受限于图片大小. https://app.yinxiang.com/shard/s24/nl/2726253 ...

  9. LightGBM两种使用方式

    原生形式使用lightgbm(import lightgbm as lgb) import lightgbm as lgb from sklearn.metrics import mean_squar ...

  10. 2.4 Go语言基础之切片

    本文主要介绍Go语言中切片(slice)及它的基本使用. 一.引子 因为数组的长度是固定的并且数组长度属于类型的一部分,所以数组有很多的局限性. 例如: func arraySum(x [3]int) ...