Changes

Jump to: navigation, search

OPS245 Lab 5

166 bytes added, 15:35, 7 February 2021
m
Part 1: Hard Disk Space Utilities: - clarifying instructions
# Note the disk space usage for the '''/''' and '''/home''' partitions.
# If a partition is running out of available space, the Linux System Administrator can reallocate space among partitions or add another disk and grow the file system. The administrator can also investigate the cause of low disk space. Two examples immediately come to mind: excessive use of space from users, and potential penetration from hackers.
# To investigate excessive disk usage by regular users, you can obtain a total amount of disk usage for that user by issuing the command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">du -ha . ~<username> | more</span></code></b>
# If there is a recurring space usage problem with regular users, the Linux system administrator can impose quotas (caps on disk usage). This method is not taught in this course.
# The methods to monitor potential penetration to a Linux system are too numerous, and are taught in other courses (for example: SEC520). One method of monitoring potential penetration is use the find command(Note that '''find''' relies on the permissions of the user currently running it. Compare the results of running this command with and without sudo):<br><b><code><span style="color:#3366CC;font-size:1.2em;">find -P / -size +100000k</span></code></b>
# The next section will apply some of these tools we have discussed into a shell script and crontab entry to periodically monitor and contact the system administrator of potential disk space issues (before they become a serious problem).
|{{Admon/tip|Bash Shell Scripting Tips:|<br>'''<u>Using awk to Manipulate Text</u>'''<br><br><ul><li>Very useful command for report generation, text file repair, or text and floating-point decimal manipulation. The command mimics a C program, with braces '''{ }''' that surround the action to perform based on records from a database file matching either test conditions, regular expressions, etc. Fields appear as numbers with $.<br><br></li><li>Examples:<br><br>''awk '{print}' data-file.txt''<br>''awk -F";" '{print $5,$3}' data-file.txt''<br>''awk -F"," '$4 &gt;&#61; 10000 {print $1, $2}' salary.txt''<br><br></li></ul>'''<u>Crontab (Chronograph Tables)</u>'''<br><br><ul><li>Used to automatically run (as opposed to manually run) scripts, programs, or commands. There are many tables (files), but the main one is: '''/etc/cron'''. The '''crontab''' command can be used to ''list'', ''create'', ''modify'' or ''remove'' scheduled jobs in the file.<br><br></li><li>Examples:<br><br>''crontab -e -u user'' # create/modify<br>''crontab -r -u user-name'' # remove specific user's crontab<br>''crontab -l -u username'' #List current schedules</li></ul>}}
|}
 
===Part 2: Using crontab to Automatically Alert System Administrator of Low Hard Disk Space===
932
edits

Navigation menu