当前位置:   article > 正文

Ubuntu18.04 开机自启服务------网易云音乐api自启服务_自制网易云后台服务启动

自制网易云后台服务启动


1.建立 rc-local.service 文件

sudo vim /etc/systemd/system/rc-local.service

2.复制下列内容到 rc-local.service 文件中

  1. [Unit]
  2. Description=/etc/rc.local Compatibility
  3. ConditionPathExists=/etc/rc.local
  4. [Service]
  5. Type=forking
  6. ExecStart=/etc/rc.local start
  7. TimeoutSec=0
  8. StandardOutput=tty
  9. RemainAfterExit=yes
  10. SysVStartPriority=99
  11. [Install]
  12. WantedBy=multi-user.target

3.创建文件 rc.local

sudo vim /etc/rc.local

4.复制下列内容到 rc.local 文件中

  1. #!/bin/sh -e
  2. #
  3. # rc.local
  4. #
  5. # This script is executed at the end of each multiuser runlevel.
  6. # Make sure that the script will "exit 0" on success or any other
  7. # value on error.
  8. #
  9. # In order to enable or disable this script just change the execution
  10. # bits.
  11. #
  12. # By default this script does nothing.
  13. node /opt/NeteaseCloudMusicApi-master/app.js
  14. exit 0

5.给 rc.local 加上权限,启用服务

  1. sudo chmod 755 /etc/rc.local
  2. sudo systemctl enable rc-local

6.启动服务并检查状态

  1. sudo systemctl start rc-local.service
  2. sudo systemctl status rc-local.service

 

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/73026
推荐阅读
相关标签
  

闽ICP备14008679号