Case Study Lab III: RAM Patrol – checking memory leaks

Task Overview
Description of the task

Write swap-checker.sh script that checks whether it is not the exhaustion of RAM, or is ready to use swap space in a defined, pre-defined periodic intervals. You can use the free command (for tests./free.pl). In the event that begins to fulfill the swap space, send mail to root@locahost. Check its operation through mutt.

To simulate the exhaustion of RAM we are for you programmed script free.pl. In the script you can use it instead of the command free.

Program the lock to a flood of email. When the RAM is full, send mail only once. You can send another email when the RAM is emptied, and the RAM is filled again.

Technical instructions

For solving the problem follow these steps:

  • Edit /etc/crontab, ensure that the memory is checked every 10 minutes. Ensure that the swap was beyond email sent to the email box once.
  • You can send email through command by this way: #mail -s "subject" address@domain.eu