12.07.2015 Views

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 11Automating Taskswith ScriptsIN THIS CHAPTER. Writing Scripts with Bash. Additional Scripting Languages. Scheduling Tasks with CronWhen an administrator has to perform the same task onhundreds, possibly thousands, of systems, automatingeveryday maintenance and deployment operations is anecessity. <strong>Red</strong> <strong>Hat</strong> Network allows <strong>Red</strong> <strong>Hat</strong> <strong>Enterprise</strong> <strong>Linux</strong>administrators to schedule package updates, package installations,operating system installations, and more, but whatabout other tasks such as monitoring disk space, performingbackups, and removing users?This chapter explains how to automate these tasks andothers like it as scripts. It also gives step-by-step instructionsfor scheduling the execution of the scripts using thecron daemon.<strong>Red</strong> <strong>Hat</strong> <strong>Enterprise</strong> <strong>Linux</strong> offers a multitude of options forthe scripting language, each with its strengths and weaknesses.This chapter focuses on Bash because it is the mostcommonly used for system administration tasks, and it alsogives an overview of other popular languages.Writing Scripts with BashThe GNU Bourne Again Shell (Bash) scripting language isuseful when trying to automate a sequence of commandsor when you want to execute the same command over andover again until a certain limit is reached.Because the default shell in <strong>Red</strong> <strong>Hat</strong> <strong>Enterprise</strong> <strong>Linux</strong> is Bash,the bash RPM package is most likely already installed onyour system. You might also want to check out the manycommands from the coreutils and the util-linux packagessuch as rename to rename a group of files and basename toreturn the basename of a file without its extension.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!