Tim,

I have a simple script in /etc/init.d (on CentOS/RHEL 5+)
Looks something like this:

> #!/bin/sh
> #
> # chkconfig: 235 90 10
> # description: Starts YOUR_SERVICE to control application.
> # source function library
> . /etc/rc.d/init.d/functions
> NAME=YOUR_SERVICE
> DAEMONDIR="/usr/bin"
> DAEMON="/usr/bin/forever"
> DAEMON_ARGS="-l /var/log/YOUR_SERVICE --append --silent --spinSleepTime
> 1000 --minUptime 1000"
> APPDIR="/usr/lib/node_modules/Your_APP"
> APP_ARGS=""
> # Exit if the package is not installed
> [ -x "$DAEMON" ] || exit 1
>
> fail()
> {
>         failure
>         echo
>         echo $1
> }
> #
> # Function that starts the daemon/service
> #
> start()
> {
>         echo -n $"Starting $NAME: "
>         $DAEMON start $DAEMON_ARGS $APPDIR $APP_ARGS
>         RETVAL=$?
>         [ $RETVAL -eq 0 ] && success || failure
>         echo
>         return $RETVAL
> }
> #
> # Function that stops the daemon/service THIS IS A LITTLE BRUTE FORCE but
> it works for me.
> #
> stop()
> {
>         echo -n $"Signaling $NAME to stop: "
>         $DAEMON stopall
>         RETVAL=$?
>         [ $RETVAL -eq 0 ] && success || failure
>         echo
>         return $RETVAL
> }
> case "$1" in
>   start)
>         start
>         ;;
>   stop)
>         stop
>         ;;
>   restart)
>         stop
>         start
>         RETVAL=$?
>         ;;
>   *)
>         echo "Usage: $NAME {start|stop|restart}"
>         exit 1
>         ;;
> esac
> exit $RETVAL

That is all, then I can also use $ service YOUR_SERVICE stop|start|restart


On Mon, Aug 26, 2013 at 7:34 PM, Dylan Hassinger <d...@dylanized.com> wrote:

> For machine reboots, I think you would need a boot script that re-launches
> Forever.
>
>
> On Mon, Aug 26, 2013 at 5:35 PM, Tim Caswell <t...@creationix.com> wrote:
>
>>
>>
>>
>> On Mon, Aug 26, 2013 at 11:30 AM, Michael Pisarski <mspis...@gmail.com>wrote:
>>
>>> I use forever and have not had any issues.
>>>
>>
>> Does forever handle machine reboots?
>>
>>
>>> On Sunday, August 25, 2013 4:57:10 AM UTC-4, Fernando Segura Gòmez wrote:
>>>>
>>>> Hi.
>>>> I need help, im very newbie about how deploy my nodejs app in
>>>> production,i have always worked in localhost, but  i dont know how i can
>>>> deploy an app and run always, when i run with the command node, and  i
>>>> close my ssh program, my nodejs app is stopped.
>>>> How i can deploy and keep running my app?
>>>>
>>>  --
>>> --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines:
>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to nodejs@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> nodejs+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to nodejs+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to nodejs@googlegroups.com
>> To unsubscribe from this group, send email to
>> nodejs+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "nodejs" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to nodejs+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "nodejs" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/nodejs/S8ujZwF6zXQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> nodejs+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Michael S. Pisarski
-------------------------------------------------------------------
mspis...@gmail.com
phone: 704.900.3130
-------------------------------------------------------------------
"I cannot imagine how the clockwork of the universe can exist without a
clockmaker." - Voltaire

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to