Question: Write a script named lab6s2 that writes the current time and date, lists logged-in users, and prints the systems uptime to a log file. The
Write a script named lab6s2 that writes the current time and date, lists logged-in users, and prints the systems uptime to a log file. The time should be printed with the format of 03:55 am as opposed to military time. The date should be printed like this: 09/10/12 Numbers should be zero-padded to 2 digits (e.g. 03 instead of 3).
(It is advisable to look at the date commands many options to format your output. Also, use the uptime command to print system uptime.)
This output should be appended to a logfile named lab6s2.log. Create a cron job to execute this script every 2 minutes.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
