新建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. ZooKeeper使用命令大全

    stat path [watch]    set path data [version]    ls path [watch]    delquota [-n|-b] path    ls2 path ...

  2. 洗礼灵魂,修炼python(80)--全栈项目实战篇(8)—— 计算器

    用正则表达式开发一个计算器,计算用户给定的一串带有加减乘除的公式. 要求:不能使用eval转换字符串 分析: 要求简单,就是计算混合运算,但是不能使用eval直接转换,主要就是把整个式子中的小括号优先 ...

  3. Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

    今天在用一键安装mysql的shell脚本安装mysql-5.1.73软件后发现mysql始终无法启动,多次执行后依旧报错,只能去查看error日志,发现了如下的2个错误: 错误一:Fatal err ...

  4. 测试TCP 和 UDP 端口的方法

    测试 TCP 端口: telnel IP PORT nc -vz IP PORT 测试 UDP 端口: nc -vuz IP PORT 其中 -u 表示使用 udp 协议来进行测试. -u, --ud ...

  5. 通过Socket实现TCP编程,用户登录之服务器相应客户端,客户端和服务端之间的通信

    服务器端: 1.创建ServerSocket对象,绑定监听端口: 2.通过accept()方法监听客户端请求: 3.建立连接后通过输入流读取客户端发送的请求信息; 4.通过输出流向客户端发送响应信息; ...

  6. 【爬坑】远程连接 MySQL 失败

    问题描述 远程连接 MySQL 服务器失败 报以下错误 host 192.168.23.1 is not allowed to connect to mysql server 解决方案 在服务器端打开 ...

  7. PHP中生产不重复随机数的方法

    PHP内置函数不重复随机数        需求:要生成一个数组,这个数组里面有10个元素,都是整形,并且是1-60之间不重复的随机数.  代码: 代码示例: 1 2 3 4 5 6 7 8 9 10 ...

  8. gcc5.4报错对‘std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()’未定义的引用

    我在编译ligra是遇到了这个问题,网上搜了一遍,发现是了原因https://gcc.gnu.org/onlinedocs/libstdc%2B%2B/manual/using_dual_abi.ht ...

  9. 简单的bfs

    这里主要是写的一个简单的bfs,实例运行了RMAT10无向图,总共有1024个顶点.这种简单的bfs算法存在很明显的缺陷,那就是如果图数据过大,那么进程将会直接被系统杀死. 代码如下: #includ ...

  10. 在Eclipse中创建maven项目出现的环境警告 j2se-1.5

    Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace th ...