Remember: when building scripts, work in steps and test each step before incorporating it in your script.
Create a script that will take a (recursive) copy of files in /etc so that a beginning system administrator can edit files without fear.
Write a script that takes exactly one argument, a directory name. If the number of arguments is more or less than one, print a usage message. If the argument is not a directory, print another message. For the given directory, print the five biggest files and the five files that were most recently modified.
Can you explain why it is so important to put the variables in between double quotes in the example from Section 9.4.2?
Write a script similar to the one in Section 9.5.1, but think of a way of quitting after the user has executed 3 loops.
Think of a better solution than move -b for the script from Section 9.5.3 to prevent overwriting of existing files. For instance, test whether or not a file exists. Don't do unnecessary work!
Rewrite the whichdaemon.sh script from Section 7.2.4, so that it:
Prints a list of servers to check, such as Apache, the SSH server, the NTP daemon, a name daemon, a power management daemon, and so on.
For each choice the user can make, print some sensible information, like the name of the web server, NTP trace information, and so on.
Optionally, build in a possibility for users to check other servers than the ones listed. For such cases, check that at least the given process is running.
Review the script from Section 9.2.2.4. Note how character input other than q is processed. Rebuild this script so that it prints a message if characters are given as input.
Saturday, December 21, 2024 @ 7:25:14 AM
z.ServerAdmin@lam1.us