LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 09-09-2007, 02:32 AM   #1
sausagejohnson
Member
 
Registered: Mar 2004
Location: Canberra, Australia
Distribution: Fedora Core 9
Posts: 242

Rep: Reputation: 30
Question Automatic grub choice on reboot


Hi Guys, here is an interesting situation that I would like to see if anyone has an idea on.

For many years I have had two choices in my grub list:

1. Linux
2. Other OS of choice

Sometimes if I want to reboot into the other OS, I simply do a 'reboot' in a console. What I would like to do is to find a way to reboot and have choice 2 in my grub menu chosen automatically for this _one time only_.

For instance, if I wanted to reboot to the other OS, and knowing this OS is choice 2 in the grub menu I could issue a command such as:

reboot-grub-item 2

The reason I would like to do this is so that I don't have to sit at the PC waiting for Linux to shut down, restart to grub, and make the choice. I can just issue the command and go off and make myself a milo. Anyone have any ideas here?
 
Old 09-09-2007, 04:37 AM   #2
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 53
Perhaps "Method 1" on this page: http://sidvind.com/wiki/GRUB:_Boot_another_OS_once

Now for the important question, what's a milo?
 
Old 09-09-2007, 05:36 AM   #3
sausagejohnson
Member
 
Registered: Mar 2004
Location: Canberra, Australia
Distribution: Fedora Core 9
Posts: 242

Original Poster
Rep: Reputation: 30
Smile

Many thanks! That is exactly what I was after.

Yes... I should explain a milo. Basically an Australian powdered chocolate milk product: http://en.wikipedia.org/wiki/Nestl%C3%A9_Milo
 
Old 09-09-2007, 11:28 AM   #4
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 53
Hmm, I don't think I'd like a milo

Btw, you might want to script the rebooting in Method 1, and perhaps place the script under /usr/local/bin/.
 
Old 09-10-2007, 05:01 AM   #5
sausagejohnson
Member
 
Registered: Mar 2004
Location: Canberra, Australia
Distribution: Fedora Core 9
Posts: 242

Original Poster
Rep: Reputation: 30
Thumbs up

Ah it's good stuff indeed.

I actually did make a script to do the job for me at /usr/local/bin/windows. In case anyone wants to use it:

Code:
#!/bin/bash

if [ "$1" != "-p" ]; then
        echo -e "Do you wish to boot to windows? Use -p, ie: windows -p\n"
        exit
fi

echo "savedefault --default=3 --once" | grub --batch
reboot
Of course replace the -default=3 with the correct choice in your own grub menu. The numbering starts at 0. So in my case 3, is 4th in the list.
 
  


Reply

Tags
automatic, choice, grub, reboot, time


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding an option to 2007 : OS choice at reboot Sabinou Mandriva 7 11-05-2006 05:01 PM
automatic reboot uhustick Debian 2 07-01-2006 04:19 PM
Automatic Multiple-Choice Test Evaluation mehlkelm Linux - Software 1 05-26-2005 03:44 AM
Automatic Reboot scottpioso Linux - General 11 12-10-2003 04:18 PM
2.4.21 kernel causes automatic reboot pilot1 Linux - General 5 07-19-2003 02:44 PM


All times are GMT -5. The time now is 12:37 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration