mersenneforum.org Automatically starting mprime.
 Register FAQ Search Today's Posts Mark Forums Read

 2004-09-28, 05:55 #1 xode   Sep 2004 710 Posts Automatically starting mprime. I want mprime to automatically start when a specific user (say userx) logs in but not when linux as a whole is started. What scripts need to be modified and how. Please provide details. I am running Mandrake 9.0.
 2004-09-28, 07:38 #2 garo     Aug 2002 Termonfeckin, IE 32×307 Posts What shell are you running? The easiest way is to add it to the rc script - say .bashrc or .cshrc.
 2004-09-29, 03:14 #3 xode   Sep 2004 7 Posts I'm guessing that it is bash, since that is what the terminal consoles identify themselves as. However, all of it runs in a GUI format, which, as far as I currently know, is completely independent of any shells. George Woltman said something about modifying rc.local. What is that, what does it do and how can you safely modify it? Please provide details.
2004-09-29, 22:35   #4
geoff

Mar 2003
New Zealand

115710 Posts

Quote:
 Originally Posted by xode However, all of it runs in a GUI format, which, as far as I currently know, is completely independent of any shells.
A simple-minded approach would be to start mprime when the X-windows session starts and stop it when it ends. That would not allow for the possibility of console or remote logins, or multiple simultaneous logins by the same user, but if that is OK then you just need to modify the .Xsession script in the user's home directory (or create it if it doesn't exist). The following works on my system (Debian), in principle it should work on any system running X-windows, but in practice some distributions bypass the .Xsession script. If it doesn't work then maybe someone who has a Mandrake system could help. Change x-window-manager and MPRIMEDIR to suit your system. The script may also be called .xsession.
Code:
#!/bin/sh
MPRIMEDIR=$HOME/gimps # Start mprime in the background. mprime -b -W$MPRIMEDIR
# Start the window manager.
x-window-manager
# Stop mprime.
kill grep -i "^Pid=" $MPRIMEDIR/local.ini | cut -d= -f2  2004-09-30, 02:52 #5 Xyzzy "Mike" Aug 2002 24×503 Posts Code: kill grep -i "^Pid="$MPRIMEDIR/local.ini | cut -d= -f2 You could use "killall" for that, I think...
2004-09-30, 18:57   #6
PrimeCruncher

Sep 2003

2×33×13 Posts

Quote:
 Originally Posted by xode I'm guessing that it is bash, since that is what the terminal consoles identify themselves as. However, all of it runs in a GUI format, which, as far as I currently know, is completely independent of any shells. George Woltman said something about modifying rc.local. What is that, what does it do and how can you safely modify it? Please provide details.
I just stuck it in rc.local. This is the Linux startup script. I edited it using the standard RHL9 text editor. Just CD to the mprime directory and do mprime -B. Before you stick it in rc.local, work out the exact commands in the bash prompt.

 2004-10-01, 04:27 #7 geoff     Mar 2003 New Zealand 13×89 Posts rc.local is the usual place to start mprime at boot, but he wanted to start it just when a particular user logged in. (And I assume stop it when that user logged out).
 2004-10-20, 12:09 #8 rkolasie   191610 Posts For starting mprime i use crontab (in case something kills my mprime), and screen (to see how much work is done). Crontab job is set as: Code: 10/* * * * * /path/to/my/mpcheck > /dev/null 2>&1 And my mpcheck script is: Code: #!/bin/bash out=ps aux | grep mprime | grep -v grep | wc -l [if \$out -eq 0 ] then cd /path/to/my/mprime/ screen -m -d ./mprime -d fi
 2004-10-20, 14:47 #9 Xyzzy     "Mike" Aug 2002 24·503 Posts Mprime has a lock file so there is no need to check if it is running before you start it again...

 Similar Threads Thread Thread Starter Forum Replies Last Post daxmick PrimeNet 18 2019-03-17 01:12 chris2be8 FactorDB 9 2012-05-03 10:20 koekie Software 2 2012-02-06 15:39 spaz Software 9 2009-05-03 06:41 tha Software 6 2008-10-15 23:38

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

Mon Apr 19 06:16:52 UTC 2021 up 11 days, 57 mins, 0 users, load averages: 1.36, 1.60, 1.54