Linux Lab #12 (25pts)

Due Monday June 20

Use the script command to make a log of your activities. The log should be named Lab12.HOSTNAME.DATE where HOSTNAME is your hostname (fetched from an environment variable or inline execution) and DATE is the current date and time in the format MMDDYY (fetched with inline execution). (E.g. "Lab12.LINFORD3040.052305")

In answering direct questions below (as marked by the question-mark '?'), use a shell comment to give your answer. For example, if I say: "What is the command to give you the system time?" You should type, at the command prompt, "# date is the command" or something to that effect. The important part is the hash-mark '#' which causes the shell to ignore everything behind it.

I strongly recommend that you use two terminals: one to run the script command and one to test your commands before executing them under script. It's also a good idea to use shell comments to say which part of the assignment the following commands are for.

Do not run any program which generates lots of escape- and meta-characters inside a terminal running the 'script' command. This includes man, vi, and pico.

Make a backup of /home

  1. Become root
  2. Make a directory named /backup which can only be accessed by root.
  3. Show the permissions on /backup
  4. Use tar to backup /home into /backup/homes.DATE.tar where DATE is the current date in MMDDYY format.
  5. Use gzip to compress the backup. (NOTE: You can do this step in the previous step if you like. Make sure to change the file extention.)

Create a cron job for two-step backups

  1. Become root
  2. Set the EDITOR environment variable to your favorite editor (e.g. vi, emacs, pico)
  3. In a different terminal, use cron to add a job which repeats at midnight of the first day of the week and makes a backup of /home using the commands you used above.
  4. Save your crontab and exit the editor.
  5. Print the root crontab in the scripted terminal
  6. In a different terminal, use cron to add a job which repeats at 11:00 PM of the sixth day of the week and destroys all files in /backup.
  7. Print the root crontab in the scripted terminal

Wave good-bye to linux labs with your favorite expletive

  1. :)

When finished, type exit or press ^D until you get a message like "Script done, file is Lab12.HOSTNAME.DATE". To turn in the assignment, scp the logfile to 192.168.0.100:/public_3040 as user "cs3040"