[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] New command checktime
From: |
Bean |
Subject: |
[PATCH] New command checktime |
Date: |
Wed, 6 Aug 2008 19:02:46 +0800 |
Hi,
I implement this command for grub4dos some time ago, now it's ported to grub2.
Usage:
checktime min hour day_of_month month day_of_week
The five parameters for checktime is the same as in crontab: minute,
hour, day, month and day of week. This command check if the current
daytime is within the range specified by the parameters, and return
true or false accordingly. Combined this with the script support for
grub2, you can perform some operation in a selected time range.
The range of the five parameters are:
minute: 0-59
hour: 0-23
day of month: 1-31
month 1-12
day of week 0-6 (0 is Sunday)
checktime * 12-15 * 1,3-5 *
Return true on afternoon of Jan, March, April and May.
checktime * * * */2 *
Return true on Month 1,3,5,7,9,11
For example, you can use a different background image according to the
current season:
if checktime * * * 3-5 *; then
background_image /spring.png
fi
if checktime * * * 6-8 *; then
background_image /summer.png
fi
if checktime * * * 9-11 *; then
background_image /fall.png
fi
if checktime * * * 1-2,12 *; then
background_image /winter.png
fi
Or boot a different item in the morning, afternoon and evening.
2008-08-06 Bean <address@hidden>
* conf/i386-pc.rmk (kernel_img_HEADERS): Add machine/time.h.
(pkglib_MODULES): Add chktime.mod.
(chktime_mod_SOURCES): New macro.
(chktime_mod_CFLAGS): Likewise.
(chktime_mod_LDFLAGS): Likewise.
* include/grub/i386/pc/time.h: Add function grub_get_datetime.
* kern/i386/pc/startup.S: Add function grub_get_datetime.
* commands/i386/pc/checktime.c: New file.
--
Bean
checktime.diff
Description: Text Data
- [PATCH] New command checktime,
Bean <=
- Re: [PATCH] New command checktime, Robert Millan, 2008/08/06
- Re: [PATCH] New command checktime, Bean, 2008/08/06
- Re: [PATCH] New command checktime, Robert Millan, 2008/08/06
- Re: [PATCH] New command checktime, Bean, 2008/08/07
- Re: [PATCH] New command checktime, Robert Millan, 2008/08/07
- Re: [PATCH] New command checktime, Bean, 2008/08/07
- Re: [PATCH] New command checktime, Bean, 2008/08/07
- Re: [PATCH] New command checktime, Colin D Bennett, 2008/08/07
- Re: [PATCH] New command checktime, Robert Millan, 2008/08/07
- Re: [PATCH] New command checktime, Bean, 2008/08/09