mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Software (https://www.mersenneforum.org/forumdisplay.php?f=10)
-   -   Create "PID" file (https://www.mersenneforum.org/showthread.php?t=23764)

Gerard 2018-11-02 14:18

Create "PID" file
 
I am running FreeBSD 11.2 / amd64 with the latest version of mprime for that system.

I have discovered that "mprime" does not create a "PID" file. I am starting "mprime" with a startup script in the "rc.d" directory. It would be easier if "mprime" actually created a "PID" file.

I am wondering if it is something that might be considered in future versions? :banana:

Thanks!

irowiki 2018-11-02 18:32

You could try creating it like so:

[url]https://superuser.com/questions/238412/write-a-pid-file-manually-from-bash-script[/url]


I had to do something similar once on my webserver to get [URL="https://mmonit.com/monit/"]monit[/URL] to monitor a process that didn't create a pid file either.

Speaking of that... I wonder if I could use monit to start/restart mprime...

Prime95 2018-11-02 19:34

I'll look into adding this for the next release.

Gerard 2018-11-03 08:02

[QUOTE=Prime95;499372]I'll look into adding this for the next release.[/QUOTE]


Great idea. It really doesn't take too much programming code to accomplish it and it does make running and monitoring programs easier.


:tu:

GP2 2018-11-03 12:16

The file [c]local.txt[/c] gets updated with a [c]Pid=[/c] line when mprime runs. Would that be sufficient?

Gerard 2018-11-06 14:41

[QUOTE=GP2;499448]The file [c]local.txt[/c] gets updated with a [c]Pid=[/c] line when mprime runs. Would that be sufficient?[/QUOTE]


Not really. Programs like [URL]https://mmonit.com/monit/[/URL] use the PID file to determine if the application is running. It is also used in "rc" startup scripts in FreeBSD. In FreeBSD, "man 3 pidfile" gives a good bit of info on how to create and use the PID file. :banana:

irowiki 2018-11-06 16:19

I'll dig up one of my monit pid creation scripts from my webserver for you and post it when I can.

Gerard 2018-11-06 16:58

[QUOTE=irowiki;499741]I'll dig up one of my monit pid creation scripts from my webserver for you and post it when I can.[/QUOTE]


I have done that myself; however, it is not really the best idea. The program that is started should create the PID and remove it when it terminates. It should also check for any stale PID files and remove them upon startup. It is for those very reasons that I abandoned that idea. I am not looking to reinvent the wheel here.


All times are UTC. The time now is 20:43.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.