mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2022-09-03, 18:53   #1
Silbe
 
Aug 2022

3 Posts
Smile 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
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
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
/var/local/gimps/prime.txt


Code:
PauseWhileRunning=PAUSE_MERSENNE
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.
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.
Silbe is offline   Reply With Quote
Old 2022-09-28, 21:47   #2
Happy5214
 
Happy5214's Avatar
 
"Alexander"
Nov 2008
The Alamo City

991 Posts
Default

Thanks for the tip, but I wish we didn't need this sort of kludge. mprime could have actual handlers for SIGSTOP and SIGCONT 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.
Happy5214 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pause/resume a process Prime95 Linux 8 2018-06-18 18:07
Work Fetch - External Command 0PolarBearsHere MISFIT 31 2017-08-30 20:44
Scripts thread bsquared YAFU 4 2012-10-21 19:45
Escape sequences in bash scripts? CRGreathouse Software 16 2009-03-26 08:42
Need an extra brain? Try an external one! ewmayer Lounge 3 2009-02-04 20:51

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


Fri Jul 7 14:12:45 UTC 2023 up 323 days, 11:41, 0 users, load averages: 1.45, 1.34, 1.25

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔