1. Modify your solution to Exercise 12.6 to send the formatted output to the file "Ex12_06.out". 2. Read Exercise 12.7. Partial solution ex12_7.pl is available on today's page. Complete the format declaration in the solution program to produce the required table. 3. Skim the manual page for the information about the "last" command %man last Next, run the last command on your system and examine the output (type Ctrl-C when done): %last | more You can attach the output of a command to a file handle as shown in process_last.pl. After that you can use the file handle as usual. Complete process_last.pl script to do the following (use formats): A. For each day in the log, report how often each user logged in. B. For every user in the log, report the number of logins and and the average time on the system. C. Report how often user "root" logged in. D. Since your log file is very short, modify the code to read last.log file available on course page and produce reports for #A and #B. How many report pages did you generate? (The purpose of this question is to make sure you know how to use $% variable). E. Report the dates and times of the system reboot (Examine the last few lines of last.log to determine the format. You can use the following command to do so: %tail last.log Note: 6+22:35 in the last column means the user was logged in for 6 days, 22 hours and 35 minutes. If the last field is "still logged in" compute the total duration on the system based on the day of login and time and the current day and time. 4. Write a program to rotate log files. Rotate apache's error.log over a period of 1 week. Here are more details: Assume, that you run the script today and the current directory contains only error.log file. Copy error.log file into error.log.0 file and exit the script. Assume, that you run the script today and the current directory contains error.log and error.log.0. Now, your script should copy error.log.0 into error.log.1 and error.log into error.log.0. .... Assume, that you run the script and the current directory contains error.log, error.log.0, error.log.1, error.log.2, errror.log.3, error.log.4, error.log.5, and error.log.6. Your script should delete error.log.6, copy error.log.5 into error.log.6, copy error.log.4 into error.log.5, ....., copy error.log into error.log.0. 5. Download error.log file from the course web page into your current working directory. Run your solution to Exercise 12.8 using error.log file. Does your program produce the output exactly as shown on p. 398? Examine error.log to find why the output differs (compare to the sample line from the error log on p. 386). Modify your code to produce the exact output. [If you didn't write the program, Deitel's solution is available in ex12_8.pl file]. 6. Modify rotation script from Problem # 4 as follows: A. Intermediate level: modify this script to perform rotation at a certain time of the day only (You can use localtime to find the current time, sys admins would do it in a cron script, though). For example, only do the rotation if the script is executed between midnight and 1:00am. Otherwise, do nothing. B. Advanced level: modify this script to do the rotation of the real Apache error.log. The script should be executed by user "root" only if root provided correct password. Hint: use getpwuid() and crypt functions.