Comments (23)
@Unitech I got the Empty error , please have a look. My server is CentOS release 6.4 (Final).
Thanks!
from pm2.
According to this stackoverflow post I think that the OS checking part is a bit fastidious and checking the update-rc.d script just take 1 line of code so I'd vote for the second way of doing this :).
from pm2.
I get the same error.
from pm2.
Is there an update-rc.d tool like in CentOS ?
from pm2.
Looks like chkconfig might be the centos version http://linuxcommand.org/man_pages/chkconfig8.html
from pm2.
I want this too, please!
from pm2.
On CentOS 6.4 i had to add some config at the begining of the file...
# chkconfig: 2345 98 02
It's means booting at levels 2,3,4 and 5 and the other two numbers (98 02) are the priorities at boot and shutdown time i think
#!/bin/bash
# chkconfig: 2345 98 02
#
# description: PM2 next gen process manager for Node.js
# processname: pm2
#
### BEGIN INIT INFO
# Provides: pm2
....
from pm2.
I think it's okay now, someone can tell me if it works on CentOS ?
To try the startup script :
$ npm install git://github.com/Unitech/pm2.git -g
$ pm2 startup centos
Thanks for feedback
from pm2.
$ pm2 startup centos
Launching daemon
{ online: true, success: true, pid: 22761 }
⌬ PM2 You have to run this command as root
⌬ PM2 Execute the following command :
⌬ PM2 sudo env PATH=$PATH:/usr/bin pm2 startup
Is that what you expected?
from pm2.
Yes, can you try now the command
sudo env PATH=$PATH:/usr/bin pm2 startup centos
from pm2.
I have a Linux AMI based on Redhat. Would you be able to get this script working for Redhat too?
from pm2.
@ecoad give me more clues about how to start a process at startup on Redhat with V init scripts, thanks
from pm2.
@mani95lisa
Your AMI probably uses chkconfig
(like CentOS). From the looks of it, it probably succeeded. The init script would be in /etc/init.d/pm2-init.sh
.
from pm2.
I have the same problem as @mani95lisa. Gives no feedback, does create the init script, but nothing starts on startup
from pm2.
Can you copy paste the output of chkconfig --list
?
from pm2.
https://gist.github.com/howtoinstallghost/8367225
also has the error from the pm2 error log
Thanks,
David
from pm2.
I have to use forever to make it right, hope this problem could be resolved.
from pm2.
At least pm2 has generated the init script.
Here is the line doing the chkconfig : https://github.com/Unitech/pm2/blob/master/lib/CLI.js#L204
If someone know the right command line to set a script at startup on CentOS, please share (:
from pm2.
This worked for me on CentOS6.4
$ crontab -e
@reboot /root/.nvm/v0.11.9/bin/node /root/.nvm/v0.11.9/bin/pm2 resurrect
*/5 * * * * /root/.nvm/v0.11.9/bin/node /root/.nvm/v0.11.9/bin/pm2 dump
Just replace these values by what is written on the /etc/init.d/pm2-init.sh (node and pm2)
Tell me if it worked for you also
from pm2.
@Unitech Your suggestion above works for me. I wanted to avoid using the cron to resurrect so I looked into why the init.d script wasnt working for me. I am running on the Amazon Linux AMI and the default init.d script was not starting my application. In the init.d script I removed the super function and all the calls to it and it started working for me.
Not sure if this is a bug with the init.d script but it worked for me.
from pm2.
I've written a dedicated startup script for centos :
https://github.com/Unitech/pm2/blob/master/lib/scripts/pm2-init-centos.sh
It uses su instead of sudo and creates the lockfile to call the init script on shutdown.
Available on pm2 0.7.2
$ chkconfig --del pm2-init.sh
$ pm2 dump
$ npm install pm2@latest
$ pm2 kill ; pm2 resurrect
$ pm2 startup centos
from pm2.
I was able to run the startup command on an Oracle Linux machine, might have been Red Hat, even though I tried using redhat as a platform option.
pm2 startup centos
This worked beautifully, my pm2 processes restart when the server restarts.
from pm2.
👍
from pm2.
Related Issues (20)
- Sudden PM2 core dump. Asking for assistance in finding the root cause, if possible. HOT 2
- `pm2 logs` with a namespace doesn't work if run before relevant `pm2 start`
- PM2 and cluster mode in Node.js/TypeScript HOT 5
- ***Urgent***: GNU-AGPL License Concerns HOT 1
- https://id.keymetrics.io/api/oauth/register not loading HOT 1
- Slow and crush HOT 2
- Suddenly crased HOT 2
- Pm2 start a new daemon and delete all my apps HOT 2
- Load balancing is not distribute the load evenly
- Graviton3 support – intermittent crash/coredump HOT 1
- Configuration file management app log confusion issues.
- PM2 start with next.js is too slow
- Replace/remove/fix vizion dependency causing annoying popups flashing in Windows
- Pm2 God Daemon crashes and does not properly recover
- Logs more than 2 years before are included into current daily logs with huge sizes HOT 1
- pm2 out_file : dev/null not working HOT 1
- How to use Pm2 for deferent Port in NextJS app
- == HELP == status errored
- pm2 do not start first
- Can not run pm2 runtime with nextjs?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pm2.