Schedule a command to run at a later time.
Syntax sched Print the scheduled-event list sched [+]hh:mm command Add command to the scheduled-event list sched -n Remove item n from the event list Examples Adding a command to the scheduled-event list. > sched 11:00 echo It\'s eleven o\'clock. This causes the shell to echo `It's eleven o'clock.' at 11 AM. The time may be in 12-hour AM/PM format: > sched 5pm set prompt='[%h] It\'s after 5; go home: >' or may be relative to the current time: > sched +2:15 /usr/lib/uucp/uucico -r1 -sother (A relative time specification may not use AM/PM format.) Removing an item 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
The sched shell variable may be set to define the format in which the scheduled-event list is printed.
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 when the command is to be run, but an overdue command will execute at the next prompt.
A command which comes due while the shell is waiting for user input is executed immediately. However, normal operation of an already-running command will not be interrupted so that a scheduled-event list element may be run. This mechanism is similar to, but not the same as, the at(1) command on some Unix systems.
Its major disadvantage is that it may 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 provides a mechanism for changing one's working environment based on the time of day.
sched is a bash built-in command.
"Management by objectives works if you know the objectives. Ninety percent of the time you don't" ~ Peter Drucker
cron - Daemon to execute scheduled commands
crontab - Schedule a command to run at a later time
jobs - List active jobs
© Copyright SS64.com 1999-2013
Some rights reserved