Script to automatically reboot to newly compiled kernel with fallback


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Script to automatically reboot to newly compiled kernel with fallback
# 1  
Old 12-27-2009
Script to automatically reboot to newly compiled kernel with fallback

Hi,
I'm new here. Just started playing around with kernel compilation.
I need a little bit of advice.
I'm trying to do a bash script to automatically compile a kernel package and reboot to that new kernel by default, with fallback to the old kernel.
So far, I'm getting stuck at the part where I need to reboot and load the new kernel as default.
I'm intending for this script to be used on systems using grub (legacy).

If I'm not wrong, I would need to change the menu.lst file to something like this:
Code:
default saved
fallback 1
timeout 5

title New, kernel 2.x.xa
root (hd0,0)
kernel /new root=/dev/sda1
initrd /boot/initrd.img-2.x.xa
savedefault 1

title Orig, kernel 2.x.xb
root (hd0,0)
kernel /old root=/dev/sda1
initrd /boot/initrd.img-2.x.xb

title Other, kernel 2.x.xc
root (hd0,0)
kernel /old root=/dev/sda1
initrd /boot/initrd.img-2.x.xc

If so, how should I go about to manipulate the menu.lst file?
I'm guessing that I might need to use awk to parse through the file, count the entries to get the entry number of the new kernel and the original kernel.
If that is the case, how can I do that with awk? (Not too good with awk, I usually use sed. )
Or are there better alternatives to this?
Thanks in advance.

Last edited by pludi; 12-28-2009 at 02:42 AM.. Reason: code tags, please...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run a script before and after reboot automatically and send output to two locations.

Hello Team . I am working a health check script ( bash) to run on linux server ( RedHat) and requirements are 1. The o/p of script need to be send to two diff files . I am testing with tee command . But I am not successful yet , any recommendations if that is the right approach ? 2. The same... (2 Replies)
Discussion started by: Varja
2 Replies

2. Red Hat

Update kernel Linux without reboot?!

Hi Is it a way ? When Linux kernel updated that don't want reboot it means without reboot the new kernel performances Thanks (7 Replies)
Discussion started by: mnnn
7 Replies

3. IP Networking

[ipv6_test] Kernel is not compiled with IPv6 support

Hello, i tried to enable IPv6 networking and after service network restart i seen these messages: FATAL: Error inserting ipv6 (/lib/modules/2.6.18-348.16.1.el5.028stab108.1/kernel/net/ipv6/ipv6.ko): Device or resource busy CRITICAL : Kernel is not compiled with IPv6 support Bringing up... (6 Replies)
Discussion started by: postcd
6 Replies

4. AIX

How can we re-mount the RAM disk automatically after the reboot on AIX?

Hi All, I was trying to know more about RAM disk concept in AIX. I found something on IBM site. I was able to create and use/delete RAM disk as per IBM instructions. But as you guys know, this RAM disk is a temporary storage. (*when ever we reboot the AIX LPAR, content/RAM disk will be... (4 Replies)
Discussion started by: System Admin 77
4 Replies

5. AIX

Loading AIX kernel extensions on reboot

Greetings, Does anyone know how to load AIX kernel extensions on reboot? I know that Oracle loads it's postwait kernel extension via a executable in /etc/inittab. I'm assuming this executable calls the "sysconfig" system call and loads it. What if I wrote my own? What is the proper way in AIX to... (3 Replies)
Discussion started by: jbleistein
3 Replies

6. Shell Programming and Scripting

How to run script automatically on reboot as root user?

Hi friends,,, I am running one server on Ubuntu 12.04 LTS 32-bit, some times my pc restarts automatically, with no reason, I have a script to start server which requires root password. in this directory /myserver/start_server.sh How can I do this ? and some scripts I am having that I... (1 Reply)
Discussion started by: Akshay Hegde
1 Replies

7. Solaris

Newly Compiled GCC 4.4.4 on Solaris sparc gives problem with -m32/-m64 flags

Hello experts, This issue has kept me busy all day long. It started off with openssl compilation which was giving linking error with following message: /usr/local/bin/ld: target elf32-sparc not found collect2: ld returned 1 exit status I tried every step possible thing that I could think... (2 Replies)
Discussion started by: d_shanke
2 Replies

8. UNIX for Dummies Questions & Answers

Make sure kernel was compiled with NFS server support

Hi there, I have a Debian Squeeze server. How can I check if my kernel was compiled with NFS server support? Extra question: if it is not, how do I enable NFS support in my kernel? Thanks for your help. Santiago (3 Replies)
Discussion started by: chebarbudo
3 Replies

9. Red Hat

Kernel panic after hard reboot and fsck

Could you please help with problem with megaraid controller and Dell PowerEdge 2850, all that I can see on thi screenshot: All drives successfuly passed verifing from LSI controllers (Ctrl+A at startup), also I tried to boot from rescue llive cd and mount all the morrored drives and check... (22 Replies)
Discussion started by: nikkadim
22 Replies

10. AIX

Automatically mounting a filesystem after a reboot

Hi All, I am new to AIX. I am having problems mounting a filesystem after a system reboot. Steps: 1. Create and Map LUN to host 2. On the host, to detect/configure the LUN: /usr/sbin/cfgmgr 3. Create a filesystem: mkfs -V vxfs /dev/hdisk757 4. Create a mountpoint: mkdir -p... (3 Replies)
Discussion started by: austin4397
3 Replies
Login or Register to Ask a Question