[Unit]
Description=描述
After=syslog.target network.target remote-fs.target nss-lookup.target [Service]
Type=simple
WorkingDirectory=程序路径
User=root
ExecStart=/bin/sh -c "exec 执行程序(例:npm run xxx) >> 输出文件(例:xxx.log) 2>&1"
PrivateTmp=true [Install]
WantedBy=multi-user.target

放在/etc/systemd/system目录下即可用systemctl start/stop命令启动停止服务了 (需要chmod授权一下)

linux中service模板的更多相关文章

  1. Linux中service命令和/etc/init.d/的关系

    Linux中service命令和/etc/init.d/的关系   service xxx启动 /etc/init.d/ 目录下的xxx脚本 如一个脚本名为 mysvc保存在/etc/init.d/下 ...

  2. linux中service *** start与直接运行/usr/bin/***的区别

    在linux想要运行启动一个服务有两种方法: 1,运行/etc/init.d/目录下的shell脚本,还可以有快捷方式,service *** start/ stop/restart /status, ...

  3. linux中service XX start与直接运行/usr/bin/xx start的区别

    在linux想要运行启动一个服务有两种方法: 1,运行/etc/init.d/目录下的shell脚本,还可以有快捷方式,service *** start/ stop/restart /status, ...

  4. linux中service的问题

    1.描述问题 2.解决方案 systemctl stop firewalld systemctl mask firewalld Then, install the iptables-services ...

  5. Linux 中的 Service

    参考: cnblogs.com/xiaofan21 - linux service和daemon cnblogs.com/xuange306 - linux service命令常见使用方法 cnblo ...

  6. linux中服务(service)管理

    一.介绍 服务(service) 本质就是进程,但是是运行在后台的,通常都会监听某个端口,等待其它程序的请求,比如(mysql , sshd 防火墙等),因此我们又称为守护进程,是Linux 中非常重 ...

  7. Linux命令中service的用法

    用途说明 service命令用于对系统服务进行管理,比如启动(start).停止(stop).重启(restart).查看状态(status)等.相关的命令还包括chkconfig.ntsysv等,c ...

  8. linux centos service 参数详解

    Service文件 开门见山,直接来看两个实际的服务配置文件吧. 第一个配置是 CoreOS 系统中 Docker 服务的 Unit 文件,路径是 /usr/lib/systemd/system/do ...

  9. 【Linux】linux中文本操作利器grep,awk,sed

    grep命令 grep(global search regular expression)是一种强大的文本搜索工具,它可以使用正则表达式搜索文本,并把匹配的行打印出来.平时搜索文本中内容的时候是非常方 ...

随机推荐

  1. Windows中使用 Python 调用 Matlab 程序

    https://ww2.mathworks.cn/help/matlab/matlab_external/system-and-configuration-requirements.html http ...

  2. Linux03 文件的相关操作(touch、rm、mv、cat)

    一.touch:创建文件 进入相关的目录,使用touch 文件名 keshengtao@LAPTOP-F9AFU4OK:~$ touch kst.py keshengtao@LAPTOP-F9AFU4 ...

  3. 基于卷积神经网络的人脸识别项目_使用Tensorflow-gpu+dilib+sklearn

    https://www.cnblogs.com/31415926535x/p/11001669.html 基于卷积神经网络的人脸识别项目_使用Tensorflow-gpu+dilib+sklearn ...

  4. 登陆并访问k8s的apiserver

    kubeadm安装的k8s集群默认需要用户登陆认证,无法直接使用命令curl访问.所以首先的第一步就是获取token. 先找到k8s集群中的dns组件coredns,之前的版本使用的是kube-dns ...

  5. 【C#】课堂知识点#4

    1.回顾类中基本结构. 成员分为: a.(数据成员) , b.(方法成员) 数据成员: 字段 方法成员:方法,构造函数,属性,索引器,运算符. 属性的作用: 对字段进行访问提供get,set方法. 类 ...

  6. promethus监控mysql

    一.mysqld_exporter安装 下载页面 https://github.com/prometheus/mysqld_exporter/releases 下载最新版本 https://githu ...

  7. 关于Python中的可变对象与不可变对象的区别(转)

    转自:https://blog.csdn.net/rookinzhang/article/details/80259857 Python中可变对象和不可变对象:https://www.cnblogs. ...

  8. VisualStudio 连接 MySql 实现增删查改

    首先创建数据库,建立一个用户登录表 2.visualStudio默认是不支持MySql的,要想通过Ado.Net 操作MySql 需要在管理NeGet包添加对MySql.Data  和 MySql.D ...

  9. 2.5_Database Interface ODBC数据源及案例

    分类 用户数据源 用户创建的数据源,称为“用户数据源”.此时只有创建者才能使用,并且只能在所定义的机器上运行.任何用户都不能使用其他用户创建的用户数据源. 系统数据源 所有用户在Windows下以服务 ...

  10. 前端开发 vue,angular,react框架对比2

    在过去一年里,前端开发发展迅速,前端工程师的薪资亦是水涨船高.2019 更是热度不减,而作为近年来尤为热门的前端框架,Vue.js 自是积累了大量关注.那么,Vue.js 是适合你的框架吗?     ...