Scheduling: Schedulinghas Three Types:: - C - K - S - Q - M - F - T
Scheduling: Schedulinghas Three Types:: - C - K - S - Q - M - F - T
at
cron
YY
#at
#echo <command> |
at now
at now +2 mins
#banner hello >
/dev/pts/0
<ctrl-d>
#/var/adm/cron/at.deny
#/var/adm/cron/at.allow allows only those users listed in this file to use the
at command (including root).
#at -l
Lists at jobs
#atq [user]
#at -r
Cancels an at job
#atrm job
#atrm user
#atrm
e.g
To schedule the command from the terminal, enter a command similar to one of the
following:
If
sysadmin
is
at
5
sysadmin
<Ctrl-D>
If
sysadmin
is
at
now
$HOME/bin/sysadmin
<Ctrl-D>
in
your
in
+
current
pm
directory,
$HOME/bin/sysadmin,
2
enter:
Friday
enter:
days
Note:
When entering a command name as the last item on the command line, a full
path name must be given if the command is not in the current directory, and the
at command will not accept any arguments.
2.
Crontab:Submits,
edits,
lists,
or
removes
cron
crontab [-e [UserName] | -l [UserName] | -r [UserName] | -v[UserName] | File ]
jobs.
The crontab command submits, edits, lists, or removes cron jobs. A cron job is a command
run by the cron daemon at regularly scheduled intervals. To submit a cron job, specify the
crontab command with the -e flag. The crontab command invokes an editing session that
allows you to create a crontab file. You create entries for each cron job in this file. Each
entry must be in a form acceptable to the cron daemon. For information on creating entries,
see
The
crontab
File
Entry
Format.
Security
Only the root user or the owner of the crontab file can use UserName following the -e, -l,-r,
and x-small;>-v flags to edit, list, remove, or verify the crontab file of the specified user.
Controls
on
/var/adm/cron/cron.allow
Using
the
crontab
Command
File containing users who allowed cron service
/var/adm/cron/cron.deny
/var/adm/cron/at.allow
/var/adm/cron/at.deny
# crontab e
changes user can save and quit.
# crontab l
# crontab r
this command will remove all the cron jobs. You should be
very careful in running these commands in production environment.
The crontab File Entry Format
A crontab file contains entries for each cron job. Entries are separated by newline characters.
Each crontab file entry contains six fields separated by spaces or tabs in the following form:
minute
hour
day_of_month
month
weekday
command
These fields accept the following values:
minute
0 through 59
hour
0 through 23
day_of_month 1 through 31
month
1 through 12
weekday
command
a shell command
00
* <command>
To write the time to the console every hour on the hour, enter:
0****
>/dev/console
echo
The
hour
is
`date`
30
6
*
*
1,3,5
/usr/bin/calendar
3. batch: Runs jobs when the system load level permits.i.e system is average.
Batch
The batch command reads from standard input the names of commands to be run at a later
time and runs the jobs when the system load level permits. The batch command mails you all
output from standard output and standard error for the scheduled commands, unless you
redirect that output. It also writes the job number and the scheduled time to standard error.
When thebatch command is executed, it retains variables in the shell environment, and the
current directory; however, it does not retain open file descriptors, traps, and priority.
The batch command is equivalent to entering the at -q b -m now command. The -q b flag
specifies the at queue for batch jobs.
Examples
To
run
a
job
when
the
system
load
permits,
enter:
batch <<!
longjob
!This example shows the use of a Here Document to send standard input to the batch
command.
Files
/usr/bin/batch
/bin/batch
/var/adm/cron
/var/spool/cron/atjobs
Designed by