![]() |
Easy way to pause mprime by external bash scripts.
I just started mprime, I wanted to make it pause during some of the my cron jobs (bash scripts) that cannot be recognized by the name (it's not like you run another intensive program that you can identify by the name).
What did not work: [CODE] mprime -m -w/var/lib/gimps killall -s SIGINT mprime # (or SIGTSTP or SIGSTOP) killall -s SIGCONT mprime [/CODE]In interactive mode (-m), SIGCONT does not restart the calculation. In non-interactive, SIGTSTP or SIGINT just exit mprime. My solution: [CODE]ln -s /usr/bin/sleep /usr/local/bin/PAUSE_MERSENNE[/CODE]Inside any shell script (3600 is a timeout in case the script exits unexpectedly before the kill command) [CODE] #!/bin/bash /usr/local/bin/PAUSE_MERSENNE 3600 & PID_PAUSE_MERSENNE=$! # script commands # ... kill $PID_PAUSE_MERSENNE [/CODE] /var/local/gimps/prime.txt [CODE] PauseWhileRunning=PAUSE_MERSENNE [/CODE]Result: [CODE] [Work thread Sep 3 19:19] Stopping PRP test of Mxxxxxxxxx at iteration 19589852 [17.13%] [Work thread Sep 3 19:19] Pausing because PAUSE_MERSENNE is running. ### later when the script finishes... [Work thread Sep 3 19:19] Resuming processing. [/CODE]Maybe it could be trivial to advanced users but posted anyway in case it could be useful to other new users like me, an dit took me a while to find the solution. |
Thanks for the tip, but I wish we didn't need this sort of kludge. mprime could have actual handlers for [c]SIGSTOP[/c] and [c]SIGCONT[/c] that would (in interactive mode) invoke the corresponding menu entries and drop back to the menu, or (in non-interactive mode) simply pause and resume execution.
|
| All times are UTC. The time now is 14:12. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.