mersenneforum.org How do I display status on startup with Ubuntu
 Register FAQ Search Today's Posts Mark Forums Read

 2011-03-01, 07:02 #1 SSteve   Mar 2011 Sierra Foothills, CA 68 Posts How do I display status on startup with Ubuntu Preamble (go ahead and skip this paragraph): I used to run Prime95 back in the legacy v4.0 days. I stopped when I finally retired my last Windows machine after switching to OS X. (The initial reason I was interested in OS X is because is was built on Unix which I was originally introduced to in college in the early 80s.) Recently I saw that Prime95 was updated to run under OS X so I installed it on two Core 2 Duo iMacs (my rank is currently 1190). I had a quad-core AMD machine that I built but ended up not using gathering dust in the corner of my office. I decided to use it for GIMPS so I installed Ubuntu 10.10 and mprime. I went to System -> Preferences -> Startup Applications and set up the machine to automatically run mprime -d on startup. I can see under System Monitor that it's working. Here's the question: Instead of having mprime start and run without a window when I start Ubuntu, I'd like to have it open a terminal window and display mprime's status to stdout. I'm not sure how to do this and would appreciate some guidance.
2011-03-01, 15:36   #2
KingKurly

Sep 2010
Annapolis, MD, USA

BD16 Posts

Quote:
 Originally Posted by SSteve Here's the question: Instead of having mprime start and run without a window when I start Ubuntu, I'd like to have it open a terminal window and display mprime's status to stdout. I'm not sure how to do this and would appreciate some guidance.
Try the -m switch when starting it up. For even more fun, run mprime inside screen so you can detach and reattach the session while it keeps running.

2011-03-01, 17:25   #3
SSteve

Mar 2011
Sierra Foothills, CA

68 Posts

Quote:
 Originally Posted by KingKurly Try the -m switch when starting it up. For even more fun, run mprime inside screen so you can detach and reattach the session while it keeps running.
Thanks for the reply. My question is where do I put the mprime (or screen mprime) command to have it automatically run in a window when I log in. If I put it in ~/.bashrc it only runs when I manually open Terminal.

2011-03-01, 18:17   #4
KingKurly

Sep 2010
Annapolis, MD, USA

BD16 Posts

Quote:
 Originally Posted by SSteve Thanks for the reply. My question is where do I put the mprime (or screen mprime) command to have it automatically run in a window when I log in. If I put it in ~/.bashrc it only runs when I manually open Terminal.
My apologies, I misunderstood the situation. I'm sorry; I don't have a good answer for you. Have you tried running a search on the forums? Or maybe someone else can chime in hopefully.

2011-03-01, 19:18   #5
tichy

Nov 2010

22×19 Posts

Quote:
 Originally Posted by SSteve Thanks for the reply. My question is where do I put the mprime (or screen mprime) command to have it automatically run in a window when I log in. If I put it in ~/.bashrc it only runs when I manually open Terminal.

[EDIT] https://help.ubuntu.com/community/UbuntuBootupHowto

Last fiddled with by tichy on 2011-03-01 at 19:19

2011-03-03, 06:02   #6
mdettweiler
A Sunny Moo

Aug 2007
USA (GMT-5)

141518 Posts

Quote:
 Originally Posted by SSteve Thanks for the reply. My question is where do I put the mprime (or screen mprime) command to have it automatically run in a window when I log in. If I put it in ~/.bashrc it only runs when I manually open Terminal.
You may want to try a cron job, with a line like this in your crontab:

@reboot cd mprime-directory; ./mprime -d &> stdout.log

(IIRC you can also use @logon in place of @reboot, but @reboot is probably better in this case since it will run even when you're not logged on, and you won't accidentally get two colliding mprimes running if you log in a second time via SSH or the like.)

Once mprime has been started from the cron job, it will pipe all its console output into the text file stdout.log inside your mprime directory. To "attach" (not quite the correct term in this case, but it works approximately similarly) to mprime's console output, open a terminal to the mprime directory and run "tail -f stdout.log". It will display the last handful of console output lines and update the screen with new lines in real time. Ctrl-C will return you to the terminal (but still leave mprime running, since you only Ctrl-C'd the tail command). To stop mprime properly, run "pkill mprime" from a terminal.

There are of course numerous other ways of doing this (running mprime inside screen, for instance--I don't remember the command to start a particular program directly into a detached screen, but I know there is one--you can swap that into the above cron entry in place of the "./mprime -d &> stdout.log" part), but this is one of the more simple methods. You can also use a an /etc/init.d/ script to start mprime (as detailed in tichy's links) but personally I find crontab the easiest since it lets you run the desired command as a non-root user without fancy footwork.

 2011-03-03, 16:56 #7 EdH     "Ed Hall" Dec 2009 Adirondack Mtns 3·372 Posts If you're using Gnome Desktop, the following should be much simpler: Note: for the following, my path to mprime is /home/math01/Mathwork/mprime/ and the script is stored in /home/math01/Mathwork/. 1. write a bash script using your favorite text editor - - example: Code: #!/bin/bash cd /home/math01/Mathwork/mprime gnome-terminal -e "./mprime" - - (saved in /home/math01/Mathwork/ as mprimear.sh) 2. test bash script by opening a terminal in Mathwork and trying: Code: bash mprimear.sh 3. open System>Preferences>Startup Applications 4. choose Add Code: Name: Mprime Autorun Command: bash /home/math01/Mathwork/mprimear.sh Comment: starts mprime at logon 5. choose Save 6. note that checkbox on left is checked 7. choose Close You should be able to convert my paths to yours and add the mprime switches within the quotes. This should now autorun in a terminal window whenever you log on. Last fiddled with by EdH on 2011-03-03 at 17:23
2011-03-04, 05:14   #8
SSteve

Mar 2011
Sierra Foothills, CA

2×3 Posts

Quote:
 Originally Posted by EdH If you're using Gnome Desktop, the following should be much simpler:
Perfect! That's exactly what I was looking for. The gnome-terminal command was the trick. I had tried using screen, but it didn't bring up anything visible. Thanks a ton.

 Similar Threads Thread Thread Starter Forum Replies Last Post Unregistered Information & Answers 1 2013-06-29 15:40 davieddy Forum Feedback 3 2011-06-12 00:45 ThomRuley Hardware 3 2005-01-17 23:11 Proggie Software 1 2004-12-19 11:54 Unregistered Linux 4 2003-12-05 20:40

All times are UTC. The time now is 02:35.

Wed Dec 1 02:35:48 UTC 2021 up 130 days, 21:04, 3 users, load averages: 1.79, 1.49, 1.45