mersenneforum.org  

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

Reply
 
Thread Tools
Old 2011-03-01, 07:02   #1
SSteve
 
Mar 2011
Sierra Foothills, CA

616 Posts
Default 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.
SSteve is offline   Reply With Quote
Old 2011-03-01, 15:36   #2
KingKurly
 
KingKurly's Avatar
 
Sep 2010
Annapolis, MD, USA

33·7 Posts
Default

Quote:
Originally Posted by SSteve View Post
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.
KingKurly is offline   Reply With Quote
Old 2011-03-01, 17:25   #3
SSteve
 
Mar 2011
Sierra Foothills, CA

2×3 Posts
Default

Quote:
Originally Posted by KingKurly View Post
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.
SSteve is offline   Reply With Quote
Old 2011-03-01, 18:17   #4
KingKurly
 
KingKurly's Avatar
 
Sep 2010
Annapolis, MD, USA

33×7 Posts
Default

Quote:
Originally Posted by SSteve View Post
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.
KingKurly is offline   Reply With Quote
Old 2011-03-01, 19:18   #5
tichy
 
Nov 2010

22×19 Posts
Default

Quote:
Originally Posted by SSteve View Post
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.
How about this: http://embraceubuntu.com/2005/09/07/...run-at-bootup/

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

Last fiddled with by tichy on 2011-03-01 at 19:19
tichy is offline   Reply With Quote
Old 2011-03-03, 06:02   #6
mdettweiler
A Sunny Moo
 
mdettweiler's Avatar
 
Aug 2007
USA (GMT-5)

624910 Posts
Default

Quote:
Originally Posted by SSteve View Post
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.
mdettweiler is offline   Reply With Quote
Old 2011-03-03, 16:56   #7
EdH
 
EdH's Avatar
 
"Ed Hall"
Dec 2009
Adirondack Mtns

3,253 Posts
Default

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
EdH is offline   Reply With Quote
Old 2011-03-04, 05:14   #8
SSteve
 
Mar 2011
Sierra Foothills, CA

2×3 Posts
Default

Quote:
Originally Posted by EdH View Post
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.
SSteve is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stats won't display Unregistered Information & Answers 1 2013-06-29 15:40
How to display the date davieddy Forum Feedback 3 2011-06-12 00:45
Trouble with display ThomRuley Hardware 3 2005-01-17 23:11
Help with Startup Script Proggie Software 1 2004-12-19 11:54
Linux Startup Unregistered Linux 4 2003-12-05 20:40

All times are UTC. The time now is 00:09.

Tue Aug 4 00:09:44 UTC 2020 up 17 days, 19:56, 0 users, load averages: 1.34, 1.49, 1.51

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