centos forever node 开机自启动
来源:互联网 发布:windows无法与dns通信 编辑:程序博客网 时间:2024/05/29 18:18
1 进入 /etc/init.d, 新建文件 nodeserver(名字可以随便取)
cd /etc/init.d
touch nodeserver
2 编辑nodeserver
#!/bin/sh# chkconfig: 2345 85 15# description: Startup script for nodeserver.# exit on first errorset -e# points to the root for forever configexport "FOREVER_ROOT=/root/.forever"#LOG=/data/nodeserver/logPID=/data/nodeserver/pidstarts=( "/usr/local/bin/forever --sourceDir /var/www/html/drunk start drunk.js" "/usr/local/bin/forever --sourceDir /var/www/html/wx start wxapi.js")# commands to run on "stop" (new line per command)stops=( "/usr/local/bin/forever stop --pidFile $PID /var/www/html/drunk/drunk.js" "/usr/local/bin/forever stop --pidFile $PID /var/www/html/wx/wxapi.js")# start functiondo_start(){ for i in "${starts[@]}" do $i done}# stop functiondo_stop(){ for i in "${stops[@]}" do $i done}# Decide what command is being calledcase "$1" in start) echo "Starting nodeserver..." do_start echo "done." ;; stop) echo "Stoping nodeserver..." do_stop echo "done." ;; restart) echo "Restarting nodeserver..." do_stop do_start echo "done." ;; *) echo "Usage: nodeserver {start|stop|restart}" >&2 exit 3 ;;esacexit 0
3 加入开机项:
chkconfig --add nodeserver
4 nodeserver命令
service nodeserver start
service nodeserver stop
service nodeserver restart
0 0
- centos forever node 开机自启动
- Centos开机自启动
- centos 开机自启动
- centos 开机自启动
- CentOS 开机自启动脚本
- CentOS 开机自启动脚本
- Centos开机自启动redis
- Centos开机自启动redis
- CentOS 开机自启动脚本
- CentOS设置开机自启动
- Centos开机自启动redis
- CentOS 开机自启动脚本
- Centos开机自启动redis
- centOS 开机自启动配置
- Centos开机自启动redis
- centos定义开机自启动
- Centos下开机自启动node.js程序(问题及总结)
- linux centos 开机自启动服务
- 1153 - Paquet plus grand que 'max_allowed_packet' (navicat)
- oracle 触发器的实例
- 数据库表分割技术浅析(水平分割/垂直分割/库表散列)
- Apache2.4.9本地访问正常但是在局域网或外网IP拒绝访问
- java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
- centos forever node 开机自启动
- 【OpenMP】并行的中断,解决error C3010: “break”: 不允许跳出 OpenMP 结构化块
- Java 组播发送数据和接受数据实例
- 恢复旋转排序数组
- android-小细节
- javascript基础十一(正则表达式)
- VM扩展名类型
- 得到屏幕的宽和高,然后在代码里面设置控件的宽和高,加载gif图片
- 八数码(康托展开)