新建umpserver.service

[Unit]
Description=UMPServer
After=syslog.target network.target remote-fs.target nss-lookup.target [Service]
Type=forking
ExecStart=/home/work/start.sh
ExecStop=/home/work/stop.sh
PrivateTmp=true [Install]
WantedBy=multi-user.target

添加可执行权限

chmod +x umpserver.service

把文件复制到/lib/systemd/system/目录下

cp umpserver.service /lib/systemd/system

添加开机启动

systemctl enable umpserver.service

移除开机启动

systemctl disable umpserver.service

启动或停止umpserver命令

systemctl stop umpserver.service

该指令,执行umpserver.service中,ExecStop属性中指定的脚本,如下图所示

 

启动umpserver命令,执行/home/work/start.sh脚本

systemctl start umpserver.service

重启命令:

systemctl restart umpserver.service

相当于,先执行umpserver的stop命令,在执行start命令。

查看是否开机启动命令:

systemctl list-unit-files |grep umpserver

enabled表示开机启动;disable表示开机不启用。

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  8. Linux—添加开机启动(服务/脚本)

    系统启动时需要加载的配置文件 /etc/profile./root/.bash_profile/etc/bashrc./root/.bashrc/etc/profile.d/*.sh./etc/pro ...

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

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

随机推荐

  1. 原型模式ProtoType

    #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/3/4 21:49 # @Author : ChenAdong # @emai ...

  2. Python基于皮尔逊系数实现股票预测

    # -*- coding: utf-8 -*- """ Created on Mon Dec 2 14:49:59 2018 @author: zhen "&q ...

  3. MyBatis笔记----报错Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.ij34.model.UserMapper.selectUser

    信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@41cf53f9: startup ...

  4. MyBatis笔记----报错:Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)解决方法

    报错 Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound st ...

  5. [20181007]12cR2 Using SQL Patch 2.txt

    [20181007]12cR2 Using SQL Patch 2.txt --//12cR2 已经把sql打补丁集成进入dbms_sqldiag,不是11g的 DBMS_SQLDIAG_INTERN ...

  6. Python学习手记

    1.Python大小敏感.print写作PRINT或Print是不对.2.注释符是“#”,而非“//”.3.语句结尾不必须分号.4.转义符为“/”+转义字母.这点与刀莱特一致.5.单引号输入使用“/' ...

  7. Windows Server 2016-Active Directory域服务端口汇总

    本章为大家简单整理一下有关Windows server Active Directory和Active Directory域服务(AD DS)组件的端口要求.生产环境中我们在做网络调整.防火墙或者开关 ...

  8. 3d max 动作Take 001改名

    问题描述 带动作的Fbx文件导入Unity之后,动作名字为Take 001,如下所示: 在max那边是没有办法改名的,只能在Unity中改名. 方法1 1. 选中动画文件,按Ctrl + D,复制一份 ...

  9. js获取select选中的内容

    ### 获取select选中的内容 js获取select标签选中的值 var obj = document.getElementById("selectId");//获取selec ...

  10. Win10改AHCI无需重装系统(无需改注册表)的方法

    下面就开始:1.开机后按下WIN键 加 R键2.输入 msconfig3.如图中所示进行点击.1 引导界面 2安全引导打钩 .最小打钩 3 下面的确定.4.点击重新启动5.在重启时连续按 F2 进入B ...