1  新建service配置文件

  vi /etc/systemd/system/node.service

[Unit]
Description=My super nodejs app
[Service]
# set the working directory to have consistent relative paths
WorkingDirectory=/home/root/Heroku/
# start the server file (file is relative to WorkingDirectory here)
ExecStart=/usr/bin/node /home/root/Heroku/server.js
# if process crashes, always try to restart
Restart=always
# let 500ms between the crash and the restart
RestartSec=500ms
# send log tot syslog here (it doesn't compete with other log config in the app itself)
StandardOutput=syslog
StandardError=syslog
# nodejs process name in syslog
SyslogIdentifier=nodejs
# user and group starting the app
User=root
Group=root
# set the environement (dev, prod…)
Environment=NODE_ENV=production [Install]
# start node at multi user system level (= sysVinit runlevel 3)
WantedBy=multi-user.target

2 启动服务

  service star node

3 查看服务启动状态

  systemctl status node

4 开机启动

  systemctl enable node

参考:

https://riptutorial.com/node-js/example/28713/node-js-as-a-systemd-damon

debian系列systemd 配置nodejs服务的更多相关文章

  1. WCF系列教程之WCF服务配置工具

    本文参考自http://www.cnblogs.com/wangweimutou/p/4367905.html Visual studio 针对服务配置提供了一个可视化的配置界面(Microsoft ...

  2. CentOS7系列--3.2CentOS7中配置iSCSI服务

    CentOS7配置iSCSI服务 在网络上的存贮服务为iSCSI Target,而连接到iSCSI Target服务的叫iSCSI Initiator 1. 直接配置iSCSI Target服务 1. ...

  3. CentOS7系列--3.1CentOS7中配置NFS服务

    CentOS7配置NFS服务 1. 配置NFS服务器端 1.1. 安装nfs-utils软件 [root@server1 ~]# yum install -y nfs-utils Loaded plu ...

  4. 在Debian系列Linux系统Ubuntu上安装配置yum的试验

    用习惯了Red Hat系统的都知道我们习惯于三种安装方式:一种是rpm包的方式安装,一种就是tar包的方式来安装,还有一种方式就是yum源的安装. 首先rpm包的用法,我们一般是在Red Hat光驱里 ...

  5. SpringCloud系列九:SpringCloudConfig 基础配置(SpringCloudConfig 的基本概念、配置 SpringCloudConfig 服务端、抓取配置文件信息、客户端使用 SpringCloudConfig 进行配置、单仓库目录匹配、应用仓库自动选择、仓库匹配模式)

    1.概念:SpringCloudConfig 基础配置 2.具体内容 通过名词就可以发现,SpringCloudConfig 核心作用一定就在于进行配置文件的管理上.也就是说为了更好的进行所有微服务的 ...

  6. CentOS7系列--2.2CentOS7中配置SSH服务

    CentOS7配置SSH服务 1. SSH配置 1.1. 使用SSH服务更加安全 [root@centos7 ~]# vi /etc/ssh/sshd_config 设置如下 PermitRootLo ...

  7. CentOS7系列--2.1CentOS7中安装配置NTP服务

    CentOS7安装配置NTP服务 NTP服务是时间同步服务 1. 安装NTPd [root@centos7 ~]# yum install -y ntp [jack@centos7 ~]$ vi /e ...

  8. MyCat源码分析系列之——配置信息和启动流程

    更多MyCat源码分析,请戳MyCat源码分析系列 MyCat配置信息 除了一些默认的配置参数,大多数的MyCat配置信息是通过读取若干.xml/.properties文件获取的,主要包括: 1)se ...

  9. debian下samba配置

    debian下samba配置  http://blog.chinaunix.net/uid-2282111-id-2113216.html 服务器端配置过程:1. apt-get install sa ...

随机推荐

  1. 来自鸟哥的lftp客户端软件使用方法

    lftp (自動化腳本) 單純使用 ftp 總是覺得很麻煩,有沒有更快速的 ftp 用戶軟體呢?讓我們可以使用類似網址列的方式來登入 FTP 伺服器啊?有的,那就是 lftp 的功能了! lftp 預 ...

  2. rm命令反向选择删除文件

    反向删除文件, 参考这篇文章. http://blog.csdn.net/web_go_run/article/details/46009723 shopt是设置shell的全局选项 shopt -p ...

  3. AssertionError: View function mapping is overwriting an existing endpoint function: insertCase

    首先,理解这个错误是什么意思,以及出现的原因: 使用Flask定义URL的时候,如果出现"AssertionError: View function mapping is overwriti ...

  4. 关于 token

    用户在浏览器做一系列操作,后台服务怎么判断这些操作是来自同一个用户? 1. seesion 用户登录后,后台生成 sessionid 返回给浏览器,浏览器的每次请求带上 sessionid,后台关联 ...

  5. robot framework :List Variables-List变量及其用法

    [转自:https://blog.csdn.net/yezibang/article/details/52692342] 这一讲我们重点来介绍List Variables-List变量及其用法. 一. ...

  6. Python uuid库中 几个uuid的区别

    在用到uuid库的时候,发现uuid有很多个,比较好奇,就查了一下他们的区别 uuid1()——基于时间戳 uuid2()——基于分布式计算环境DCE(Python中没有这个函数) uuid3()—— ...

  7. linux 软连接的使用

    软连接是linux中一个常用命令,它的功能是为某一个文件在另外一个位置建立一个同不的链接. 具体用法是:ln -s 源文件 目标文件. 当 我们需要在不同的目录,用到相同的文件时,我们不需要在每一个需 ...

  8. failed to create process ,pip报错问题

  9. tomcat 端口8080占用问题

    启动tomcat时,有时会出现8080端口占用的问题. 解决方法: 终端:ps -e | grep tomcat 会看到下边的结果 途中标记的是进程号,kill掉即可. kill -9 9734(97 ...

  10. postgresql 口令: psql: 致命错误: 用户 认证失败

    在Windows环境下使用psql 命令出现认证失败. 网上找了很多,都没讲到要点 D:\program\PostgreSql\bin>psql口令: psql: 致命错误: 用户 " ...