[CS-FSLUG] scheduled jobs with at and cron WAS: Linux standby and wake on a schedule

Josiah Ritchie jritchie at bible.edu
Mon Oct 4 08:57:23 CDT 2004


On Sun, 03 Oct 2004 23:20:14 -0600
"N. Thompson" <n.thomp at sasktel.net> wrote:

> I'm wondering how a computer is put into standby mode in Linux, I've 
> ever really found the feature anywhere and my new computer seems to 
> support it rather well.
> 
> I'm also wondering if it would be possible to schedule wake up times for 
> when the computer is in standby and I want it to come back.
> 
> With that would it also be possible to use my computer as an alarm clock 
> in the mornings with some sort of program, I would rather not use a cron 
> job since I know very little about it.
> 
> I would appreciate any input from the list, now that I know my computer 
> can successfully go on standby and wake from it I'm interested in what I 
> could do with that.

Cron is ideal and not as arcane and difficult as it first looks. 'at' might
also be useful as an alternative. The two are complementary. atd runs as
a service that uses at commands to recieve one-time jobs. a sample command
might be

# at
at> 5:30am xmms /home/music/riseandshine.ogg
at> ^d
#

Check to make sure it took with the command atq (as in printer queue).

This would tell xmms to play the Ogg Vorbis file specified at 5:30 the next
morning. It would not play it the following morning. You could do this
recurringly with cron using a command like this in crontab would do the
same thing Monday through Friday, plus wake you for church on Sunday at a
different time.

#min hour dom mon doy command
30 5 * * Mon-Fri xmms /home/music/riseandshine.ogg &
15 7 * * Sun xmms /home/music/riseandshine.ogg &

You have 5 fields like below followed by the command to run.

	   field	 allowed values
	   -----	 --------------
	   minute	 0-59
	   hour		 0-23
	   day of month	 1-31
	   month	 1-12 (or names, see below)
	   day of week	 0-7 (0 or 7 is Sun, or use names)

You'd probably want to find a text based music player for this.

As you see, it's not really all that hard. Alternately, you could just toss
a little shell script in /etc/cron.[daily|hourly|weekly]/ for run at
certain lengths of time, but that isn't as exact as one could hope for and
you might be late or early. :-)

JSR/




More information about the Christiansource mailing list