Skip to contentSkip to conversation

Proposition for Add-on

DISCUSSION Michel Benoit 3 participants 3 messages Dec 2, 2013

lore
Share & tools
lore
#0 lore raw

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
[email protected]

#1 lore raw

The way things like this are usually done on mailing lists like this one are that you post a patch file containing the changes that you have made to the entire project, not simply the source file you want included. There are special commands for this, which you can find on the Internet. You also typically put the patch in the body of your message without formatting.

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

Quoted 80 lines · Michel Benoit

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
[email protected]

#2 lore raw
In reply to Michel Benoit
Quoted 5 lines · Michel Benoit

Hi!

I’ve d develop an internal command for grub to help the administrators of pool of dual boot machine.

Quoted 9 lines

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.

No neede to write a module for this. Just do:
insmod datehook
if [ $HOUR -ge 4 -a $HOUR -lt 6 ]; then
default=linux
else
default=windows
fi

Quoted 73 lines

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
[email protected]

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel