From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VnHNL-00082R-Jj for mharc-grub-devel@gnu.org; Sun, 01 Dec 2013 19:28:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnHNH-000822-Ng for grub-devel@gnu.org; Sun, 01 Dec 2013 19:28:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnHNG-0007sR-4t for grub-devel@gnu.org; Sun, 01 Dec 2013 19:28:31 -0500 Received: from mail-oa0-x22b.google.com ([2607:f8b0:4003:c02::22b]:41461) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnHNF-0007sN-TM for grub-devel@gnu.org; Sun, 01 Dec 2013 19:28:30 -0500 Received: by mail-oa0-f43.google.com with SMTP id i7so12468313oag.30 for ; Sun, 01 Dec 2013 16:28:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=QxVGFRVICJ2ZSz6DSPpudpG67JhNqaFBoJun4fFPv7M=; b=D3ZpNh9wT8S/vSopGGII/qvLv19aDzItL2/icGADVwNtM2QtSUfAPxSE+aQl9k0Zff 8kZzu36SWbBlVu5Qx4Kh5l4c1qduiKi0dJphwOhUtTwd9EiKJljDeBvglqLA/Rjj+2fW xlxSP0jlB5rPv0cHurKnvPEzloBDfURPwJ7eEvV5+os/IhmO96OVWescByA43rpmzSF5 m4Bv0UeLSGrzplen5Lb+BQmhARrIkWTUQ6YquFj5TpfPWWLIQ/mDEv20lgULNq/Zgaua XGOfaCXG6MnXojF3+ghQhKVjxK0quMGEwq9xFgNwzLA6AYIxxNW1rnTSAaQ2TUP0DgKn TuIA== MIME-Version: 1.0 X-Received: by 10.60.62.172 with SMTP id z12mr52274253oer.4.1385944108848; Sun, 01 Dec 2013 16:28:28 -0800 (PST) Received: by 10.182.161.71 with HTTP; Sun, 1 Dec 2013 16:28:28 -0800 (PST) In-Reply-To: <6ED1B54066274C3FB1D6D7611122D749@xps> References: <6ED1B54066274C3FB1D6D7611122D749@xps> Date: Sun, 1 Dec 2013 19:28:28 -0500 Message-ID: Subject: Re: Proposition for Add-on From: SevenBits To: The development of GNU GRUB Content-Type: multipart/alternative; boundary=001a11c20976495d3c04ec8242fa X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c02::22b X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2013 00:28:33 -0000 --001a11c20976495d3c04ec8242fa Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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 On Sunday, December 1, 2013, Michel Benoit wrote: > Hi! > > I=92ve 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 instal= l > 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 an= d > the menuentry for that period, you can use many period of time. It use th= e > 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" # specif= ic > > =96----------------------------------------------------------- > --------------------------- > > Right now, we are using select_by_time with 98_select_by_time, and we sav= e > a lot of days of work. > If you think it could be helpful for other administrator, could you put i= t > 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=E8mes Ordin=E9s > Dep. Informatique > Universit=E9 de Sherbooke > michel.benoit@usherbrooke.ca > --001a11c20976495d3c04ec8242fa Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable The way things like this are usually done on mailing lists like this one ar= e that you post a patch file containing the changes that you have made to t= he 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 typ= ically put the patch in the body of your message without formatting.

One of the head people on the project will then review it an= d see if it's worth including. I'm new here myself, but it's im= portant to learn the proper way to do things.

-- SevenBits=A0

On Sunday, December 1, 2013, Michel Benoit wrote:
Hi!

I=92ve 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 wind= ows we have a maintenance period in the night to automatically install upda= te. 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 g= rub that select the default menu-entry depending of the time of the day.
ex. :

=A0 =A0I set the period from 4am to 6am with the default boot to linux.
=A0 =A0So i can put a script in the crontab at 4h05 to install the update.<= br> =A0 =A0(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

=A0 =A0 =A0 =A0the simple version /etc/grub.d/98_select_by_time

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0In 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.

=A0 =A0 =A0 =A0ex:

=A0 =A0 =A0 =A0 =A0 =A0# from 4 am to 6 am select item 3 as default
=A0 =A0 =A0 =A0 =A0 =A0select_by_time 0400 0600 3
=A0 =A0 =A0 =A0 =A0 =A0# and from 11h25 pm to midnight select item 5 as def= ault
=A0 =A0 =A0 =A0 =A0 =A0select_by_time 2325 2400 5

=A0 =A0 =A0 or

=A0 =A0 =A0 =A0the more complete /etc/grub.d/99_select_by_time, that use th= e config file /boot/grub/select_by_time.cfg
=A0 =A0 =A0 =A0With this version you don't have to know the position of= the operating system in grub.cfg (menuitem).

=A0 =A0 =A0 =A0exemple of select_by_time.cfg

=A0 =A0 =A0 =A0 =A0 =A0select_default Windows
=A0 =A0 =A0 =A0 =A0 =A0select_by_time 5:00 6:00 ubuntu =A0 =A0 =A0 =A0 =A0 = # maintenance period
=A0 =A0 =A0 =A0 =A0 =A0select_by_time 13:00 15:00 ubuntu =A0 =A0 =A0 # linu= x course
=A0 =A0 =A0 =A0 =A0 =A0select_by_time 19:00 2308 "Linux 3.2.0-23-gener= ic" =A0 =A0# specific

=96--------------------------------------------------------------------------------------

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=E8mes Ordin=E9s
Dep. Informatique
Universit=E9 de Sherbooke
michel.benoit@usherbrooke.ca
--001a11c20976495d3c04ec8242fa--