Skip to content

Instantly share code, notes, and snippets.

@danitfk
Created February 6, 2019 15:13
Show Gist options
  • Save danitfk/cd8a2b8ff0c34dc43cc123aa32a300d5 to your computer and use it in GitHub Desktop.
Save danitfk/cd8a2b8ff0c34dc43cc123aa32a300d5 to your computer and use it in GitHub Desktop.
#!/bin/bash
LOADAVG=$(cat /proc/loadavg | awk {'print $3'} | cut -d. -f1)
SERVICES="mysql
httpd"
if [ "$LOADAVG" -gt 10 ]; then
for service in $SERVICES
do
echo "Restart $service"
systemctl restart $service
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment