I have a situation where something/someone is causing my system to suddenly
utilize up to 80% of available memory. Once it happens I have to restart
Apache. I am working on the issue and that's just background.

What I need is a cron job to monitor my memory usage and when it reaches,
say 40% to restart Apache. I need both the script code and the cron job to
monitor it. TIA.