[ Pobierz całość w formacie PDF ]
.For example, if the root operator creates a job at 19:30 for that day, you d seethe following:# at 19:30echo HelloJob 9 will be executed using /bin/sh# ls -l /var/spool/at-rwx------ 1 root root 3144 Nov 26 19:25 c0000900dff21e-rwx------ 1 bball bball 3146 Nov 26 19:26 c0000a00dff21edrwx------ 2 daemon daemon 1024 Nov 26 19:04 spoolAs you can see, there is a job waiting for the root operator and the user bball.Each of the filesbeginning with a c contains a shell script to execute the job (in the case of the root at job,it is only to echo the word job, which will be emailed after the job executes).You can get more specific information with the atq command.If you re theroot operator, you ll see all the jobs your users have scheduled, instead ofjust the ones you ve scheduled.JUST A MINUTE2 4Scheduling 351Controlling the batch and at CommandsSo now that you know how the at facilities run, how do you control how at works, and forwhom, on your system? One way to control the performance, is to use the atrun command s-l (load average) option.This option will control any jobs submitted by users using the batchcommand (discussed in Hour 18 with the at command).You can limit when batch jobs arerun by specifying a number lower than 1.5 (the default), which tells atrun to run batch jobsonly when the system load average (determined by a value in the /proc/loadavg file while thesystem is running) is low.You can see the current load average with# cat /proc/loadavg0.20 0.11 0.03 2/50 1228This shows the load average for the last 5, 10, and 15 minutes.You can also get the loadaverage by using the uptime command, for example:2 4# uptime7:40pm up 2:44, 3 users, load average: 0.13, 0.08, 0.02To allow your users to use batch nearly any time, change the value of the -l option in the atruncommand entry in your system s /etc/crontab file to a number higher than the default 1.5value.But how do you control whether or not users are allowed to use the at command on yoursystem? By default, after you install Linux, anyone on your system can use the at command.There are four ways to control who can or cannot use the at command.If you look in your/etc directory, you ll see a file called at.deny.Because this file is empty, everyone can use theat command to schedule jobs.If you want to restrict a user from using the at command, putthe user s username in the file.If you don t want anyone on your system to use the atcommand (of course, this doesn t apply to you, because you re the root operator!), then deletethe at.deny file from your /etc directory.If you want to allow only certain users to use theat command, then create a file called at.allow in the /etc directory, and put the user susername in the file.As a final, desperate measure, as the root operator, you can see all the at jobs scheduled onyour system with the atq command, and if you see too many jobs scheduled, you can deletethem with the atrm command, for example:# atqDate Owner Queue Job#20:00:00 11/26/97 bball c 1220:10:00 11/26/97 bball c 1320:15:00 11/26/97 bball c 1420:30:00 11/26/97 bball c 15.# atrm 12 13 14 15.352 Hour 24Here I m assuming you see a long, long list of job numbers, and have deleted them.This isan abrupt, rude way to handle enthusiastic users.A better method may be to email the userand find out if there are tasks being run that may be automated during off-hour or off-peaktimes.As the system administrator, you have complete control of scheduling commands for theusers of your Linux system.Think about tasks you should run hourly, daily, weekly, andmonthly.With a little imagination, you ll soon automate any custom tools, command lines,and reports you ve created to help you manage your system.You ll end up with more diskspace, a better running system, and happier users.2 4353INDEX-fr options (rm command), -xrm command-lineSymbolsoption65 full-time option X11 client resources, 114-i option(ls command), 64.bash_profile filecopying files and! command (ftp), 194 (customizing shells), 91directories, 70$PATH variable.newsrc file, 186mv command, 68customizing shells, 91.pinerc file, 178rm command, 65.profile file (pdksh shell),environment variables, -p option91 86copying files and$PS1 environment variable.xinitrc file, 130directories, 70(customizing shells), 92 fvwm2 window manager,rmdir command, 67-b option 107-r optioncopying files and X11 client geometrycopying files anddirectories, 70 settings, 113directories, 70mv command, 68 /bin directory, 315rm command, 65/dev directory (floppy-f options (rm command), -s option (ln command),65 devices), 31871354 /dev/modem directory (editing PPP scripts)/dev/modem directory ALTLINE, 149B(editing PPP scripts), ALTLOCK, 149166 anonymous ftp connec- backgammon (X11games), 287/dev/modem file (creating tions, 198with modemtool com- AnotherLevel configura- backgrounds (colors andpatterns)mand), 144 tion file, 105customizing with/etc/conf.uugetty.ttySX, configuring, 105-108screensavers, 119148 app-defaults directoryX11 clients, 113/etc/fstab (filesystem (X11 client resources),backups, 339-340table), 316-317 114BRU, configuring,fstool, 317 Applix Words, 224344-345su command, 317 Applixware spreadsheetcpio command, 342umount command, 317 (math tools), 268-269deleting (saving disk/etc/inittab file, 148 appointment reminders,space), 300/etc/passwd file, 84 schedulingstorage, 340/etc/resolv
[ Pobierz całość w formacie PDF ]