Section 33.7. System Customization and Automation (Topic 2.213)


33.7. System Customization and Automation (Topic 2.213)

33.7.1. Review Questions

  1. What is the function of the third field in a crontab entry?

  2. Consider the following command:

     at 4:00 9/13/08 -f command_file 

    What is another way to specify this time?

  3. You wish to use the rsync command to copy the local directory of /home/james/backup directory to the /usr/remote/backup directory of the remote system named sandi. What would this command look like?

33.7.2. Answers

  1. The day of the month.

  2. at teatime 9/13/08 -f command_file.

  3. rsync -avz /home/james/backup/ sandi:/usr/remote/backup.

33.7.3. Exercises

  1. Create a user-based crontab using the crontab -e command. If you cannot think of any particular command to use, have the command list your home directory and then print the current date. Use the mail command to verify that the script has worked. If the script doesn't work, edit it until you specify the correct commands.

  2. View the scripts in the /etc/cron.hourly, /etc/cron.d/daily, /etc/cron.weekly, and /etc/cron.monthly directories. Notice that some scripts are quite simple, whereas others are more ambitious.

  3. Create a script in the /etc/cron.hourly directory. Use the mail command to verify that the script has worked.

  4. Use the at command to have a command take place one hour from the current time. Issue the atq command to view the status of the command.

  5. Consider the following use of awk:

     sudo kill 'ps auxww | grep ethereal | egrep -v grep | awk '{print $2}'' 

    Study how awk is used in this particular command. Then go on to the Internet and review additional examples of awk usage.

  6. Consider the following rsync command:

     rsync -avz james:/home/sandi/essential/ /backup/sandi 

  7. This command copies all of the contents of the /home/sandi/essential on the remote system named james to the /backup/sandi directory of the local system. Be able to explain each option used in this command. The -a option enables archiving, which preserves all permissions, symbolic links, and other file elements. The next part of the command specifies the remote system name and the directory on the remote system, including a trailing slash. The final part of the command specifies the destination where the directory is copied.



LPI Linux Certification in a Nutshell
LPI Linux Certification in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596005288
EAN: 2147483647
Year: 2004
Pages: 257

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net