-
-
Save lancelakey/2039689 to your computer and use it in GitHub Desktop.
for sporadic wtfs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# because sometimes a server sporadically acts funny and we're all like wtf. | |
# date and -+ separated list of general os, system, and network stuff. | |
echo -e "#!/usr/bin/env bash\n(date; top -n1; ps axfu; iostat; vmstat; df -h; lsof -n -i; netstat -ano; w; echo -e '\n-----------------\n\n') >> /var/log/wtf.log" > /root/wtf.sh | |
chmod +x /root/wtf.sh | |
# put it in the crontab. | |
echo '* * * * * /root/wtf.sh' >> /var/spool/cron/crontabs/root | |
crontab /var/spool/cron/crontabs/root | |
# log rotate it in case we forget about it (and run into disk issues) | |
echo -e "/var/log/wtf.log {\nrotate 5\ndaily\ncompress\nmissingok\nnotifempty\n}" >> /etc/logrotate.d/wtf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment