sched - add an item to or print scheduled-event list



sched [+]hh:mm command 

sched -n


This command is a C-shell built-in command.

The first form prints the scheduled-event list. The sched shell variable can be set to define the format in which the scheduled-event list is printed. The second form adds command to the scheduled-event list.

For example:

> sched 11:00 echo It\'s eleven o\'clock.
causes the shell to echo "It's eleven o'clock." at 11 A.M. The time can be in 12-hour A.M./P.M. format, as follows:
> sched 5pm set prompt='[%h] It\'s after 5; go home: >'
or can be relative to the current time:
> sched +2:15 /usr/lib/uucp/uucico -r1 -sother

A relative time specification cannot use A.M./P.M. format.

The third form removes item n from the event list:

> sched
	 1  Wed Apr  4 15:42  /usr/lib/uucp/uucico -r1 -sother
	 2  Wed Apr  4 17:00  set prompt=[%h] It's after 5; go home: >
> sched -2
> sched
	 1  Wed Apr  4 15:42  /usr/lib/uucp/uucico -r1 -sother

A command in the scheduled-event list is executed just before the first prompt is printed after the time when the command is scheduled. It is possible to miss the exact time the command is to be run, but an overdue command will execute at the next prompt. A command that becomes due while the shell is waiting for user input is executed immediately. Normal operation of a command that is already running will not be interrupted, however, so that a scheduled-event list element can be run.

This mechanism is similar to, but not the same as, the at(1) command on some traditional systems. Its major disadvantage is that it might not run a command at exactly the specified time. Its major advantage is that because sched runs directly from the shell, it has access to shell variables and other structures. This allows you to change your working environment based on the time of day.