One of the head people on the project will then review it and see if it's worth including. I'm new here myself, but it's important to learn the proper way to do things.
-- SevenBits
On Sunday, December 1, 2013, Michel Benoit wrote:
Hi!
I’ve d develop an internal command for grub to help the administrators of pool of dual boot machine.
The problem: We have class with near 100 computers in dual boot, under windows we have a maintenance period in the night to automatically install update. For that, in grub we put Windows has the default menu-entry.
The only time the computers are in linux, is when a student is using it. It's not a good time to install update. To install update, security patch, or other package, i was forced to pass computer by computer.
To get a period for the maintenance in linux, i wrote a simple module for grub that select the default menu-entry depending of the time of the day.
ex. :
I set the period from 4am to 6am with the default boot to linux.
So i can put a script in the crontab at 4h05 to install the update.
(you have to put a shutdown -r command in Windows task scheduler at 4.00 am. And use a wake on lan for computer that are down)
Is it possible to integrate in in the distribution of grub, if you think it could help other user.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
The principal module grub-core/commands/select_by_time.c
The configuration file, two option
the simple version /etc/grub.d/98_select_by_time
In 98_select_by_time, you select the period of time and the menuentry for that period, you can use many period of time. It use the 24 hours time format notation without colon.
ex:
# from 4 am to 6 am select item 3 as default
select_by_time 0400 0600 3
# and from 11h25 pm to midnight select item 5 as default
select_by_time 2325 2400 5
or
the more complete /etc/grub.d/99_select_by_time, that use the config file /boot/grub/select_by_time.cfg
With this version you don't have to know the position of the operating system in grub.cfg (menuitem).
exemple of select_by_time.cfg
select_default Windows
select_by_time 5:00 6:00 ubuntu # maintenance period
select_by_time 13:00 15:00 ubuntu # linux course
select_by_time 19:00 2308 "Linux 3.2.0-23-generic" # specific
–--------------------------------------------------------------------------------------
Right now, we are using select_by_time with 98_select_by_time, and we save a lot of days of work.
If you think it could be helpful for other administrator, could you put it in a future grub distribution (the source code is very simple).
The 99_select_by_time is optional, it's just more easy to use.
Thank's
------------------------------------------------------
Michel Benoit (morph1853)
Technicien Systèmes Ordinés
Dep. Informatique
Université de Sherbooke
address@hidden