the mprime.sh I attached to my previous message already runs it as a different user
you can specify any user ... edit the script and see: RUN_AS_USER=mersenne On Nov 11, 2007 2:36 PM, Heath Volmer <[EMAIL PROTECTED]> wrote: > Wonderful to see so much response, thank you. > > > I think the init.d script will work the best, primarily because I'm > familiar with it in the Ubuntu context. > > Since root will be running this, how do I call mprime to start as a > different user? I'm assuming: > > sudo -u username ...../mprime will do the job, since that seems to > work fine from a root prompt. > > Thanks, Heath > > > > > On Nov 11, 2007, at 9:21 AM, Marnes wrote: > > > Hi, my approach is as follows. > > > > I created an user called "mersenne" (to not run mprime as root nor > > as my own). > > > > In /home/mersenne/mprime/ there are all the mprime files as usual. > > > > Attached here I put a script "mprime.sh" by Gareth Randall that I > > modified to use user "mersenne" and to run mprime inside a 'screen'. > > > > Then, install the script, as a daemon: > > > > sudo cp mprime.sh /etc/init.d > > cd /etc/init.d > > sudo update-rc.d mprime.sh defaults > > > > This script will: > > - run at boot > > - lauch /home/mersenne/mprime/mprime with option -d > > - run mprime as user mersenne > > - run mprime inside a 'screen' (so, at everytime, user mersenne can > > check the mprime current output with "screen -r"... after, to leave > > screen and let mprime running, type [ctrl]+[a] and [d], so 'screen' is > > detached) > > - save a log of START and STOP of the script in > > /home/mersenne/daemon_mprime.log (I prefer the two logs not merged... > > this log is only to the daemon... the usual mprime log is still in > > /home/mersenne/mprime/prime.log) > > > > Currently, the last five lines of my log are: > > START: Wed Nov 7 16:43:37 BRST 2007 > > STOP : Wed Nov 7 18:50:51 BRST 2007 > > START: Wed Nov 7 18:52:45 BRST 2007 > > STOP : Fri Nov 9 13:40:27 BRST 2007 > > START: Fri Nov 9 13:41:28 BRST 2007 > > > > At any time, you can (re)start or stop mprime with: > > sudo /etc/init.d/mprime start > > sudo /etc/init.d/mprime stop > > > > If any reconfiguration of mprime is needed, stop it with the above > > line, > > run "mprime -m", do the (re)configurations, leave mprime, and then > > restart it with > > sudo /etc/init.d/mprime start > > > > That's all. > > Marnes > > Brazil > > > > On Nov 11, 2007 9:28 AM, Lars Lindley <[EMAIL PROTECTED]> wrote: > >> I have it set up like this: > >> > >> A script in /etc called mersenne containing only this: > >> > >> cd /mersenne > >> ./mprime -d > >> > >> > >> I have then added this line in my /etc/inittab > >> > >> c9:2345:respawn:/bin/bash /etc/mersenne > /dev/tty9 > >> > >> This means that it will automatically start mprime and send the > >> output > >> to tty9. When I'm in console mode I can press Alt-F9 and get the > >> current > >> info. If I'm within X then it's Ctrl-Alt-F9.. > >> If mprime dies for some reason it will be automatically restarted. > >> > >> This will not help the original poster seeing the current output > >> since > >> he doesn't have local access to the server. If he wants he can > >> redirect > >> to a file instead but it is bound to get big after a while.. > >> > >> A note in the end. This setup will run mprime as root which might be > >> something frowned upon when running it on a server. On my home > >> machine I > >> don't care.. > >> > >> /Lars > >> > >> > >> > >> > >> On Sun, 2007-11-11 at 07:27 +0000, Brian Beesley wrote: > >>> On Sunday 11 November 2007 04:32, Yves Bellefeuille wrote: > >>>> Heath Volmer wrote: > >>>>> I'm fairly sure that I can get my Ubuntu server to run the mprime > >>>>> programs in the background at startup (although some advice is > >>>>> welcome). > >>>> > >>>> I have the following in /etc/rc.local: > >>>> > >>>> sudo -u yves /home/yves/gimps/mprime & > >>> > >>> This will leave the parent process in memory until mprime > >>> terminates. Why not > >>> use nohup instead. > >>>> > >>>>> My concern is since this server essentially runs headless, I > >>>>> won't be > >>>>> able to see what activity is going on. Can it be set up to run > >>>>> into > >>>>> a log file or do I need to pipe it? How am I notified of > >>>>> important > >>>>> events? > >>>> > >>>> There's a log in the files results.txt and prime.log. > >>> > >>> What Yves said. Also you can use top to keep an eye on the active > >>> processes > >>> using CPU time; mprime should normally be the biggest user of CPU > >>> resources > >>> on the system. > >>> > >>> However what I do is slightly different - I make an ssh > >>> connection with the > >>> headless server and run mprime remotely in a terminal window on > >>> my main > >>> system. This way you get the same display you would if you were > >>> working > >>> locally. The wrinkle is that the remote process crashes if the > >>> local system > >>> goes down for some reason, or you accidentally close the terminal > >>> window. > >>> > >>> Regards > >>> Brian Beesley > >>> _______________________________________________ > >>> Prime mailing list > >>> Prime@hogranch.com > >>> http://hogranch.com/mailman/listinfo/prime > >> _______________________________________________ > >> Prime mailing list > >> Prime@hogranch.com > >> http://hogranch.com/mailman/listinfo/prime > >> > > _______________________________________________ > > Prime mailing list > > Prime@hogranch.com > > http://hogranch.com/mailman/listinfo/prime > > _______________________________________________ > Prime mailing list > Prime@hogranch.com > http://hogranch.com/mailman/listinfo/prime > _______________________________________________ Prime mailing list Prime@hogranch.com http://hogranch.com/mailman/listinfo/prime