以下是我的pm2开机启动的服务脚本,
开机后,服务启动成功了,但是pm2却没有运行
是不是我的脚本写得有问题?
#!/bin/sh
# chkconfig: 2345 64 36
# description: node start scripts.
### BEGIN INIT INFO
# Provides: OSSEC HIDS
# Required-Start: $network $remote_fs $syslog $time
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OSSEC HIDS
### END INIT INFO
EXEC=/home/pi/workspace/Shanbay-Everyday
case "$1" in
start)
echo "Starting node..."
pm2 start /home/pi/workspace/Shanbay-Everyday/app.js
;;
stop)
echo "Stoping node..."
;;
*)
echo "Please use start or stop as first agrument"
;;
esac
直接运行下面命令,是可以启动成功的
pm2 start /home/pi/workspace/Shanbay-Everyday/app.js
直接启动服务,会出现下面这种情况
pi@raspberrypi:~ $ sudo service node start
Job for node.service failed. See 'systemctl status node.service' and 'journalctl -xn' for details.
代码启动成功后,会给我的邮箱发邮件,
机器重启的时候,成功的给我的邮箱发了一封邮件
但是 输入命令 pm2 l 的时候
却没有在列表里发现应用在跑
莫名其妙
Write the absolute path to the pm2 command in the script and try again.
Is yours centos 7? The startup command should be