PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: JR on May 20, 2020, 11:11:23 AM

Title: Linux Launching another pxplus daemon task
Post by: JR on May 20, 2020, 11:11:23 AM
Hi,
When launching my pxplus ATHENA daemon with command :
A=SYS("cd $home;export TERM=IO;"+ARG(0)+" ATHENA >/dev/null 2>/dev/null &")
and if I exit the current task, the ATHENA child is stopped.

But if i do it manually :
A=SYS("bash")
and
me@server:/tmp/pvx$ cd $home;export TERM=IO;/home/pxplus/pxplus ATHENA >/dev/null 2>/dev/null &
the ATHENA daemon still runs when I exit current ubuntu session.
I do not want the daemon to stop.
Any idea ?
Title: Re: Linux Launching another pxplus daemon task
Post by: Mike King on May 20, 2020, 11:46:27 AM
When you exit the parent task are you exiting the Linux session back to logon?  If so then you need to add 'nohup' or 'setsid' in front of pathname of the Executable (arg0) that you are running.  This prevents the SIGHUP from being sent to the child processes.
Title: Re: Linux Launching another pxplus daemon task
Post by: JR on May 21, 2020, 04:04:27 AM
Hi,
Thanks. Unfortunately on my Ubuntu, adding nohup or setsid is no help. Logging out kills the child anyway for unknown reason.
I finally ended getting around the problem with "at" unix command.

A=SYS("at now -f /tmp/pvx/cmd")

and the cmd file containing :

cd $home;export TERM=IO;/home/pxplus/pxplus ATHENA >/dev/null

My problem is solved.