mersenneforum.org  

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

Reply
 
Thread Tools
Old 2010-06-22, 17:50   #12
lfm
 
lfm's Avatar
 
Jul 2006
Calgary

1101010012 Posts
Default

Quote:
Originally Posted by joblack View Post
I know but why did he write it.

By the way: su means 'substitute user' and not superuser (you can switch to another (normal) user as well).
he was suggesting you use the su command to run mprime as a normal user from the /etc/rc.local init file. its a good idea to not run stuff like mprime as root when it isn't needed.
lfm is offline   Reply With Quote
Old 2010-06-29, 10:55   #13
joblack
 
joblack's Avatar
 
Oct 2008
n00bville

10110110102 Posts
Default

Quote:
Originally Posted by lfm View Post
he was suggesting you use the su command to run mprime as a normal user from the /etc/rc.local init file. its a good idea to not run stuff like mprime as root when it isn't needed.
I don't run it as root as you can see under 'su $user -c ...'. The /etc/rc.local isn't LSB standard conform and can be found on SuSE machines.
joblack is offline   Reply With Quote
Old 2010-06-30, 00:03   #14
lfm
 
lfm's Avatar
 
Jul 2006
Calgary

1A916 Posts
Default

Quote:
Originally Posted by joblack View Post
I don't run it as root as you can see under 'su $user -c ...'. The /etc/rc.local isn't LSB standard conform and can be found on SuSE machines.
yes, he was talking about ubuntu. On suse there is equivalent files in /etc/rc.d/rc.local or /etc/init.d/rc.local or something similar. Sometimes even more than one.

Frankly I don't recomend any of them, I prefer the crontab @reboot command.
lfm is offline   Reply With Quote
Old 2010-07-20, 12:52   #15
markr
 
markr's Avatar
 
"Mark"
Feb 2003
Sydney

10758 Posts
Default

I tried the OP's method in Ubuntu, but all I got was this error message : "su: must be run from a terminal". I think they've disabled su in scripts as a security measure. A bit of googling only found people trying to run something as root in a script. I've set up the crontab @reboot method instead.
markr is offline   Reply With Quote
Old 2013-09-15, 21:49   #16
nicko7i
 
Sep 2013

12 Posts
Default More on the @reboot approach

Quote:
Originally Posted by lfm View Post
An alternative that works well for me is:

echo "@reboot cd ~/gimps ; ./mprime & " | crontab -

Assuming you aren't already using crontab.
I wanted to elaborate on this suggestion. It took me a few tries to get it right, so maybe I can save someone some effort.

I installed the software in the directory '/opt/mprime'. This directory and all its files are owned by user 'nick'.

To have 'cron' automatically start the program, I created a file mprime in the /etc/cron.d directory. This file must be an ordinary text file; it must be owned by root; and it must not be write-able except by root. The file contains a single line:

@reboot nick /opt/mprime/mprime -w/opt/mprime

You can create the file with your favorite text editor, or by executing the following command (the "%" represents the prompt and is not typed as part of the command):

% sudo bash -c "echo '@reboot nick /opt/mprime/mprime -w/opt/mprime' > /etc/cron.d/mprime"

In my example, the program runs as user 'nick'. Replace 'nick' with the name of a non-privileged user and the path '/opt/mprime' with the complete path to the directory where 'mprime' lives.

If 'mprime' doesn't start after rebooting, you can check for an error message with this command:

% sudo fgrep cron /var/log/messages

I'm using SuSE 12.x. I believe this will also work on Debian/Ubuntu, but I have not tested that myself.
nicko7i is offline   Reply With Quote
Old 2018-10-29, 21:46   #17
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

113538 Posts
Default

Five years have passed since the last message on topic.

Now, having Ubuntu, and wanting to run mprime in background (./mprime &) and unmanned at each restart of the computer, especially after a power blackout (quite frequent in this season in Italy), what script would you suggest?

I have seen flavours of init.d, crontab and rc.local, with pros and cons, and would appreciate your actual hint.

Thank you
ET_ is offline   Reply With Quote
Old 2018-10-30, 15:18   #18
Mark Rose
 
Mark Rose's Avatar
 
"/X\(‘-‘)/X\"
Jan 2013

13·227 Posts
Default

I still run it like this, in my personal crontab:

`@reboot screen -S mprime -d -m /path/to/mprime/mprime -d`

Then I can reattach to see the output whenever.
Mark Rose is offline   Reply With Quote
Old 2018-11-02, 17:00   #19
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

29×167 Posts
Default

Quote:
Originally Posted by Mark Rose View Post
I still run it like this, in my personal crontab:

`@reboot screen -S mprime -d -m /path/to/mprime/mprime -d`

Then I can reattach to see the output whenever.
For some strange reason this same command does not run on my PC.
And yes, I used the correct directory
ET_ is offline   Reply With Quote
Old 2018-11-02, 17:24   #20
Mark Rose
 
Mark Rose's Avatar
 
"/X\(‘-‘)/X\"
Jan 2013

13×227 Posts
Default

Quote:
Originally Posted by ET_ View Post
For some strange reason this same command does not run on my PC.
And yes, I used the correct directory
Might need to install `screen`. Or you could modify it to use `tmux`, if that's installed or you're more familiar with that.
Mark Rose is offline   Reply With Quote
Old 2018-11-02, 17:50   #21
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

25×331 Posts
Default

Quote:
Originally Posted by Mark Rose View Post
Might need to install `screen`. Or you could modify it to use `tmux`, if that's installed or you're more familiar with that.
Or, to avoid any dependencies, I use this:
Code:
@reboot ~/prime/mprime -d </dev/null >>~/prime/mprime.log 2>/dev/null &
Then, if I want, I can log into the machine and "tail -f ~/prime/mprime.log".
chalsall is offline   Reply With Quote
Old 2018-11-02, 18:02   #22
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

29·167 Posts
Default

Quote:
Originally Posted by chalsall View Post
Or, to avoid any dependencies, I use this:
Code:
@reboot ~/prime/mprime -d </dev/null >>~/prime/mprime.log 2>/dev/null &
Then, if I want, I can log into the machine and "tail -f ~/prime/mprime.log".
It looks like on Ubuntu 16, if you create a user's crontab, you need not insert the username before the command, or the command won't be executed...

Thanks Mark and Chris.
ET_ is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
mprime 28.9 - occassional segmentation fault during start pessoft Software 0 2016-06-13 20:58
Seeking help on packaging mprime for Debian alexvong1995 Linux 3 2015-05-13 12:49
Linux (debian/grub) help LaurV Linux 10 2015-04-24 15:39
HowTo: Switch to Linux to finish factoring Batalov Linux 25 2009-09-18 06:38
Debian package of mprime Matt Linux 1 2007-02-22 22:36

All times are UTC. The time now is 16:40.


Wed Aug 17 16:40:22 UTC 2022 up 41 days, 11:27, 1 user, load averages: 1.28, 1.44, 1.37

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, 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.

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