Hello guys!
I have a ruby script that I want to run 24/7 on my vserver( Debian
Squeeze ).
Now top run that script I have to open a new ssh session with putty and
start script by console. When I close my console the script process also
closes.
How can make my script running standalone?
This is a unix question more than a Ruby question.
You have to detach it from the terminal. Use nohup.
Jesus.
···
On Wed, Jun 6, 2012 at 10:54 AM, Michael Dutchman <lists@ruby-forum.com> wrote:
Hello guys!
I have a ruby script that I want to run 24/7 on my vserver( Debian
Squeeze ).
Now top run that script I have to open a new ssh session with putty and
start script by console. When I close my console the script process also
closes.
How can make my script running standalone?
If the script needs to be run periodically (once a day or hour or
minute perhaps) then something like the unix utility cron would be of
interest, if your script sleeps for any amount of time then cron is
probably the way to go. It's installed on unix boxes by default.
If the script needs to be run continuously then a tool like monit
(which you would have to install) would be worth looking at. It will
keep the script running even if it crashes, it will just restart it if
things go wrong and make sure that it starts when your sever reboots.
Or you could just write a script for /etc/init.d that launches your
script at boot time and pray that it never crashes (which is why I
would recommend monit).
If output to stdout is needed then screen might also help.
Kind regards
robert
···
On Wed, Jun 6, 2012 at 11:17 AM, Peter Hickman <peterhickman386@googlemail.com> wrote:
If the script needs to be run continuously then a tool like monit
(which you would have to install) would be worth looking at. It will
keep the script running even if it crashes, it will just restart it if
things go wrong and make sure that it starts when your sever reboots.
Or you could just write a script for /etc/init.d that launches your
script at boot time and pray that it never crashes (which is why I
would recommend monit).
init has the "respawn" keyword for keeping scipts running even if they chrashed
afaik init is designed to keep things running, not only for strting things at boot time.
If the script needs to be run periodically (once a day or hour or
minute perhaps) then something like the unix utility cron would be of
interest, if your script sleeps for any amount of time then cron is
probably the way to go. It's installed on unix boxes by default.
If the script needs to be run continuously then a tool like monit
(which you would have to install) would be worth looking at. It will
keep the script running even if it crashes, it will just restart it if
things go wrong and make sure that it starts when your sever reboots.
Or you could just write a script for /etc/init.d that launches your
script at boot time and pray that it never crashes (which is why I
would recommend monit).
On Wed, Jun 06, 2012 at 08:22:34PM +0900, Robert Klemme wrote:
On Wed, Jun 6, 2012 at 11:17 AM, Peter Hickman > <peterhickman386@googlemail.com> wrote:
> If the script needs to be run continuously then a tool like monit
> (which you would have to install) would be worth looking at. It will
> keep the script running even if it crashes, it will just restart it if
> things go wrong and make sure that it starts when your sever reboots.
>
> Or you could just write a script for /etc/init.d that launches your
> script at boot time and pray that it never crashes (which is why I
> would recommend monit).
If output to stdout is needed then screen might also help.
Thank you for that pointer, Chad! From the feature list tmux really
seems like a major improvement over screen. Although I have to say
screen served me well so far.
Kind regards
robert
···
On Wed, Jun 6, 2012 at 9:52 PM, Chad Perrin <code@apotheon.net> wrote:
On Wed, Jun 06, 2012 at 08:22:34PM +0900, Robert Klemme wrote:
If output to stdout is needed then screen might also help.