![]() |
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.
|
What shell are you running? The easiest way is to add it to the rc script - say .bashrc or .cshrc.
|
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.
|
[QUOTE=xode]However, all of it runs in a GUI format, which, as far as I currently know, is completely independent of any shells.[/QUOTE]
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` [/CODE] |
[CODE]
kill `grep -i "^Pid=" $MPRIMEDIR/local.ini | cut -d= -f2`[/CODE]You could use "killall" for that, I think... |
[QUOTE=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.[/QUOTE]
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. |
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).
|
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 [/CODE] 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 [/CODE] |
Mprime has a lock file so there is no need to check if it is running before you start it again...
|
| All times are UTC. The time now is 08:17. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.