System Customization and Automation (Topic 2.213)

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?

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.

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 ...

Get LPI Linux Certification in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.