mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Software (https://www.mersenneforum.org/forumdisplay.php?f=10)
-   -   How can I start mprime at book on Linux? (https://www.mersenneforum.org/showthread.php?t=26605)

drkirkby 2021-03-14 19:02

How can I start mprime at book on Linux?
 
I'm trying to get mprime to start to run when a linux machine is booted, but can't seem to get this to work. Any help appreciated.

I have two operating systems of interest - Centos 7.8 (same as Redhat 7.8) and Debian 10. Both use systemd to start processes, but I can't seem to get it to work.

I found this web page
[URL]https://wiki.debian.org/systemd/Services[/URL]
on using systemd. I want to start primed as user "gimps" in the directory /home/gimps, but even my attempt to not mess with the directory and username fail. The default is to start as root in the directory /root.

I have the following in /etc/systemd/system/mprime.service
[CODE][Unit]
Description=GIMPS
After=network.target remote-fs.target nss-lookup.target


[Service]
Type=simple
Restart=always
WorkingDirectory=/home/gimps

ExecStart=/usr/local/bin/mprime

[Install]
WantedBy=multi-user.target
root@4-CORE:~# cat /etc/systemd/system/mprime.service
[Unit]
Description=GIMPS
After=network.target remote-fs.target nss-lookup.target


[Service]
Type=simple
Restart=always
WorkingDirectory=/home/gimps

ExecStart=/usr/local/bin/mprime

[Install]
WantedBy=multi-user.target
[/CODE]
Then when I try to start it, this fails.



[CODE]root@4-CORE:~# systemctl daemon-reload
root@4-CORE:~# systemctl enable mprime.service
root@4-CORE:~# systemctl start mprime.service

root@4-CORE:~# systemctl status mprime.service
‚óŹ mprime.service - GIMPS
Loaded: loaded (/etc/systemd/system/mprime.service; enabled; vendor preset: e
Active: failed (Result: signal) since Sun 2021-03-14 19:55:57 CET; 27s ago
Process: 3841 ExecStart=/usr/local/bin/mprime (code=killed, signal=SEGV)
Main PID: 3841 (code=killed, signal=SEGV)

Mar 14 19:55:57 4-CORE systemd[1]: mprime.service: Service RestartSec=100ms expi
Mar 14 19:55:57 4-CORE systemd[1]: mprime.service: Scheduled restart job, restar
Mar 14 19:55:57 4-CORE systemd[1]: Stopped GIMPS.
Mar 14 19:55:57 4-CORE systemd[1]: mprime.service: Start request repeated too qu
Mar 14 19:55:57 4-CORE systemd[1]: mprime.service: Failed with result 'signal'.
Mar 14 19:55:57 4-CORE systemd[1]: Failed to start GIMPS.
[/CODE]


I've tried starting mprime as a "simple" service, as well as "mprime -d" as forking. Neither work for me. Can anyone help me out?

S485122 2021-03-15 09:02

[QUOTE=drkirkby;573706]I'm trying to get mprime to start to run when a linux machine is booted, but can't seem to get this to work. Any help appreciated.
...
WorkingDirectory=/home/gimps

ExecStart=/usr/local/bin/mprime
...[/QUOTE]AFAIK mprime works if the executable and the accompanying files are all in one folder. If one wants to use different folders one must add specific entries in the mprime configuration files.

I would try again after moving all the mprime files to the /home/mprime folder. If you want another configuration you should delve in the undoc.txt file.

Jacob

M344587487 2021-03-15 10:01

You can learn systemd daemons if you like, but it's probably easier to just use a cron job, which on systemd systems will be a systemd service: [url]https://www.cyberciti.biz/faq/linux-execute-cron-job-after-system-reboot/[/url]


Even if you wanted to do it the "native" systemd way you'd probably use the cron replacement called timers instead of rolling your own daemon: [url]https://opensource.com/article/20/7/systemd-timers[/url]

UBR47K 2021-03-20 15:38

If you want this to work without root, place the following into [I]~/.config/systemd[/I]/user/mprime.service [B]for the user[/B] that will run mprime.
[CODE]
[Unit]
Description=Prime95 client

[Service]
Type=simple
ExecStart=/usr/local/bin/mprime -d -w%h/mprime-data
KillMode=process
KillSignal=SIGINT
Restart=always

[Install]
WantedBy=multi-user.target
[/CODE]Afterwards, still logged in as the mprime user, enable this at boot with:
[CODE]
systemctl enable --user mprime.service
[/CODE]Lastly, as root, enable lingering for that particular user with:
[CODE]
loginctl enable-linger <user>
[/CODE]


All times are UTC. The time now is 12:15.

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