Code Monkey home page Code Monkey logo

Comments (23)

mani95lisa avatar mani95lisa commented on May 22, 2024 1

@Unitech I got the Empty error , please have a look. My server is CentOS release 6.4 (Final).

image

Thanks!

from pm2.

soyuka avatar soyuka commented on May 22, 2024

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.

fakewaffle avatar fakewaffle commented on May 22, 2024

I get the same error.

from pm2.

Unitech avatar Unitech commented on May 22, 2024

Is there an update-rc.d tool like in CentOS ?

from pm2.

markkevans avatar markkevans commented on May 22, 2024

Looks like chkconfig might be the centos version http://linuxcommand.org/man_pages/chkconfig8.html

from pm2.

mani95lisa avatar mani95lisa commented on May 22, 2024

I want this too, please!

from pm2.

purepear avatar purepear commented on May 22, 2024

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.

Unitech avatar Unitech commented on May 22, 2024

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.

fakewaffle avatar fakewaffle commented on May 22, 2024
$ 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.

Unitech avatar Unitech commented on May 22, 2024

Yes, can you try now the command

sudo env PATH=$PATH:/usr/bin pm2 startup centos

from pm2.

ecoad avatar ecoad commented on May 22, 2024

I have a Linux AMI based on Redhat. Would you be able to get this script working for Redhat too?

from pm2.

Unitech avatar Unitech commented on May 22, 2024

@ecoad give me more clues about how to start a process at startup on Redhat with V init scripts, thanks

from pm2.

sudowork avatar sudowork commented on May 22, 2024

@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.

 avatar commented on May 22, 2024

I have the same problem as @mani95lisa. Gives no feedback, does create the init script, but nothing starts on startup

from pm2.

sudowork avatar sudowork commented on May 22, 2024

Can you copy paste the output of chkconfig --list?

from pm2.

 avatar commented on May 22, 2024

https://gist.github.com/howtoinstallghost/8367225

also has the error from the pm2 error log

Thanks,
David

from pm2.

mani95lisa avatar mani95lisa commented on May 22, 2024

I have to use forever to make it right, hope this problem could be resolved.

from pm2.

Unitech avatar Unitech commented on May 22, 2024

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.

Unitech avatar Unitech commented on May 22, 2024

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.

aboutte avatar aboutte commented on May 22, 2024

@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.

Unitech avatar Unitech commented on May 22, 2024

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.

frankbecker avatar frankbecker commented on May 22, 2024

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.

jshkurti avatar jshkurti commented on May 22, 2024

👍

from pm2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.