[ Pobierz całość w formacie PDF ]
.If not, the first line of the case block of code is the uname command.Atthis point we know what the OS flavor is.For HP-UX, Linux, and Solaris we executethe target OS printing function.For AIX we make an additional test to figure out whichone of the supported printing services is running.The two options are System V andthe Classic AIX printer subsystem.Notice that I removed all of the logging functionality from the functions.With thistype of setup, where you have the functions doing the work, you can move the loggingout to the main body of the shell script.This means that you can capture all of the out-put data of the function to save to a log file, use the tee command to view the datawhile logging at the same time, or just point it to the bit bucket by redirection to/dev/null.Other Options to ConsiderAs usual, we can always improve on a shell script, and these shell scripts are no excep-tion.Some options that you may want to consider are listed next. Print Queue Hell: Keeping the Printers Printing 439LoggingYou may want to add logging with date/time stamps.If you are having a lot of troublekeeping certain print queues up, studying the log may give you a trend that can helpyou find the cause of the problem.Some queues may drop in a particular location morethan others.This can indicate network problems to the site.Any time you start loggingdo not forget to keep an eye on the log files! I often see that a script is added to a pro-duction machine, and the next thing you know, the log file has grown so large that ithas filled up the filesystem.Don t forget to prune the log files.Trimming the log files isanother little shell script for you to write.Exceptions CapabilityIn a lot of shops you do not want to enable every single printer and print queue.In thiscase you can create an exceptions file, which contains the queue/printer names that youwant to exclude from enabling.You also may have special considerations if your shopuses specific forms at different times on some of the floating printers.Some shops arejust print queue hell! Having the capability to keep the majority of the printers activeall of the time and exclude a few is a nice thing to have.MaintenanceDuring maintenance windows and other times when you want to stop all printing, youmay want to comment out any cron table entries that are executing the enablingscripts.You usually find this out after the fact.SchedulingI keep a script running 24 × 7 to keep all of the printers available.You may want to tai-lor the monitoring scheduling to fit business hours (my requirement is 24 × 7).Usersloading up on print jobs during the middle of the day is always a problem, so we try tohold big jobs for times of low activity.Low activity times are the times when you wantto be at home so make sure you are keeping the printers printing during these hours,or the next morning you will have the same problem.SummaryIn this chapter we covered some unique techniques to handle the data from commandoutput.In the Linux script we used arrays to hold the data as array elements.In othercases we read in a line at a time and used tags to grab the data we needed.We learnedhow to process a specific number of lines of data in groups by using a loop counterwithin a while loop. 440 Chapter 16The techniques in this chapter are varied, but the solutions are readable and can beeasily maintained.Someone will follow in your footsteps and try to figure out whatyou did when you wrote the shell script.Do not play the  job security game becauseyou are you own worst enemy when it comes to documenting your shell scripts.If youcomment when you write the script and make a note in the REV section when you editit, you will have a long, happy life using your shell script.In the next chapter we are going to move into the world of FTP.The object of thenext chapter is to automate file transfers between systems using FTP, or file transferprotocol. CHAPTER17Automated FTP StuffIn many shops the business relies on nightly, or even hourly, file transfers of data thatis to be processed.Due to the importance of this data, the data movement must beautomated.The extent of automation in the ftp world is threefold.We want the abilityto move outbound files to another site, move inbound files from a remote location toyour local machine, and check a remote site on a regular basis for files that are ready todownload.In this chapter we are going to create some shell scripts to handle each ofthese scenarios.Most businesses that rely on this type of data movement also require some pre-ftpand post-ftp processing to ready the system for the files before the transfer takes placeand to verify the data integrity or file permissions after the transfer [ Pobierz caÅ‚ość w formacie PDF ]
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • centka.pev.pl
  •