re: SUMMARY: Process goes down

From: Hisham Al Saad <hisham.alsaad_at_gmail.com>
Date: Tue Jun 07 2005 - 03:01:58 EDT
After sending my Summary i recieved several valuable replies from
(Crist Clark, Balki Chamkura, Russell J Lebar, Thomas Anders and
Kelly). Thanks to all.

Russel send me a perl script that should do the trick but i didn't try it
yet.

#!/usr/bin/perl
use IO::Socket;
use POSIX qw(WNOHANG setsid);
$SIG{CHLD} = 'IGNORE'; # Autoreap zombies
die "Can't fork" unless defined ( my $child = fork );
CORE::exit(0) if $child; # Parent exits
setsid(); # Become session leader
open( STDIN,  "</dev/null" );
open( STDOUT, ">/dev/null" );
open( STDERR, ">&STDOUT"   );
chdir '/tmp'; # Change working dir
umask(0); # forget file mode creation mask
$ENV{PATH} = '/bin:/sbin:/usr/sbin'; # Reset path
exec "your command here";

Thomas recommends to use the at command instead of crontab
$ at now
at> /path/to/application start
at> ^D
$

Kelly also suggested the same :
A related solution, instead of using cron, is to use at.

use date to show you the time, then set the at job for a minute or 2 later.
assuming now is 12:33 (also depends on how fast you type):

at 12:34
/x/y/z/application start
ctrl-d

just a bit simpler than crontab -e, but basically the same idea.


Thanks


On 6/6/05, Hisham Al Saad <hisham.alsaad@gmail.com> wrote:
> Hi,
> Thanks a lot to all who replied to my question (Vern Walls, Mohan
> Doraiswamy ,  Roland Rebstock , Admin and Chris Sellers).
>
> I tried the below commands but they did not solve the problem:
> $ exec nohup ./application start
> $ exec nohup ./application start &
>
> I tried starting the application out of a crontab as suggested by Vern
> and it was able to keep running.
> The desadvantage is that each time i stop the process i will have to
> adjust the time of the cronjob to the nearest time possible to get
> executed.
>
> I'll also look into Chris's suggestion of using inittab to keep the
> application running.
> Meanwhile, at least the application is up and running everyone is happy :)
>
> Thanks again.
> Have a nice day.
> Hisham
>
>
>
> On 6/6/05, Hisham Al Saad <hisham.alsaad@gmail.com> wrote:
> > Hi,
> > On my Solaris 9.0 system i have an application which runs associated
> > with a specific account. I ssh to the system and run the application
> > simply by
> >
> > #su - <accountname>
> > $./application start
> >
> > The application starts fine and listens to its incoming connections
> > port and everything is fine up to here.
> > The problem arises only when i exit  from the ssh session or exit from
> > a command such as ($ tail -f  logs.log), the application with all its
> > processes will go down.
> > I tried the nohup command ($ nohup ./application start), but the
> > problem did not go away :(
> >
> > How can i keep this application running even if i exit from the ssh
session ?
> > Please advice.
> > Thanks.
> >
> > Hisham
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Tue Jun 7 09:44:50 2005

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:47 EST