NodeJS应用设成随系统启动而自动运行
来源:互联网 发布:oracle数据库建表空间 编辑:程序博客网 时间:2024/05/16 18:25
先在/etc/init.d
目录创建一个文件node
,内容如下:
#!/bin/bash## node Start up node server daemon## chkconfig: 345 85 15# description: Forever for Node.js#PATH=/home/node/0.8.9/binDEAMON=/home/ftp/1520/weizt-20120918-tKx/weizt.com/app.jsLOG=/home/hosts_logPID=/tmp/forever.pidcase "$1" in start) forever start -l $LOG/forever.log -o $LOG/forever_out.log -e $LOG/forever_err.log --pidFile $PID -a $DEAMON ;; stop) forever stop --pidFile $PID $DEAMON ;; stopall) forever stopall --pidFile $PID ;; restartall) forever restartall --pidFile $PID ;; reload|restart) forever restart -l $LOG/forever.log -o $LOG/forever_out.log -e $LOG/forever_err.log --pidFile $PID -a $DEAMON ;; list) forever list ;; *) echo "Usage: /etc.init.d/node {start|stop|restart|reload|stopall|restartall|list}" exit 1 ;;esacexit 0
以上代码是我在本地虚拟机的配置,根据实际情况修改相关参数,主要是DEAMON的路径参数,赋予该文件可执行权限,并运行chkconfig添加自动运行:
chmod 755 /etc/init.d/nodechkconfig /etc/init.d/node on
reboot重启系统,通过浏览器进入网站可发现,该NodeJS已经可自动运行了
0 0
- NodeJS应用设成随系统启动而自动运行
- WINCE系统启动,自动运行应用程序
- CE系统启动时自动运行应用程序
- WinCE系统启动时自动运行应用程序
- Windows系统启动时自动运行自定义批处理文件
- WINCE系统启动时自动运行应用程序
- CE系统启动时自动运行应用程序
- 使用forever运行nodejs应用
- 使用forever运行nodejs应用
- 使用forever运行nodejs应用
- 使用forever运行nodejs应用
- 使用forever运行nodejs应用
- 使用forever运行nodejs应用
- 使用forever运行nodejs应用
- 使用forever运行nodejs应用
- 让程序在Windows CE系统启动时自动运行
- 让程序在Windows CE系统启动时自动运行
- 让程序在Windows CE系统启动时自动运行
- 基于Qt的类QQ气泡聊天的界面开发
- 警惕:利用Dropbox链接散播的恶意软件
- SVN Application
- hasOwnProperty方法的使用
- MD5的加密和解密(总结)
- NodeJS应用设成随系统启动而自动运行
- 数据结构之进阶排序(希尔排序、快速排序、归并排序)
- ubuntu下连接mysql时报错:Lost connection to MySQL server at 'reading initial communication packet', system
- Timer中schuduel方法的使用
- 在Ubuntu 12.04.2 LTS上安装OpenGrok浏览Android源码
- u-boot 分析:Makefile详解
- 对象变量比较
- 利用DHT网络原理制作bt采集蜘蛛
- spring batch(一):基础部分