Centos里开机自启动Node 服务程序
Centos里开机自启动Node 服务程序
第一种:
vim /data/www/community-5050/start.sh
#!/bin/bash . /etc/profile su -c "cd /data/www/community-5050;nohup cnpm run start >> /data/logs/community-5050/community.log 2>&1 &" dev
vim /etc/rc.d/rc.local
#!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this file. # # In contrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. # # Please note that you must run ‘chmod +x /etc/rc.d/rc.local‘ to ensure # that this script will be executed during boot. touch /var/lock/subsys/local /bin/bash /data/www/community-5050/start.sh
授权:
chmod +x /data/www/community-5050/start.sh chmod +x /etc/rc.d/rc.local
第二种:
[ ~]# vim /data/scripts/node_enable.sh
#!/bin/bash PROJECT="$1" LISTEN_PORT="$2" WEB_BASE="/data/www" STARTUP="nohup cnpm run start" cd $WEB_BASE/$PROJECT-${LISTEN_PORT} su -c "$STARTUP >> /data/logs/$PROJECT-$LISTEN_PORT/$PROJECT.log 2>&1 &" dev
[ ~]# vim /etc/rc.d/rc.local
#!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this file. # # In contrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. # # Please note that you must run ‘chmod +x /etc/rc.d/rc.local‘ to ensure # that this script will be executed during boot. touch /var/lock/subsys/local /data/scripts/node_enable.sh community 5050
授权:
[ ~]# chmod +x /data/scripts/node_enable.sh [ ~]# chmod +x /etc/rc.d/rc.local
相关推荐
changecan 2020-11-19
ECSHOP专属建设 2020-11-13
88427810 2020-11-02
步知道 2020-10-27
Junzizhiai 2020-10-10
jackalwb 2020-10-05
小网管 2020-09-03
shiwenqiang 2020-09-14
85251846 2020-09-14
summerinsist 2020-08-21
87901735 2020-08-19
PinkBean 2020-08-11
85407718 2020-08-09
MichelinMessi 2020-07-30
suosuo 2020-07-28
CARBON 2020-07-28
lizhengfa 2020-07-27
88427810 2020-07-26