Last active
February 10, 2025 23:39
-
-
Save nocodehummel/789316aae1bbfc4353219ea3228aac56 to your computer and use it in GitHub Desktop.
Systemctl status check
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
| # check systemctl status | |
| failed_jobs=$(systemctl --failed | grep -Ei "failed" | wc -l) | |
| if [ "$failed_jobs" -gt 0 ]; then | |
| echo -e "${RED}Failed systemctl jobs detected:${NC}" | |
| tput setaf 1 | |
| systemctl --failed | |
| tput sgr0 | |
| else | |
| echo "No failed systemctl jobs." | |
| systemctl list-timers | head -n 20 | |
| fi | |
| # check disk space | |
| filesystem="/" | |
| threshold=10 | |
| usedspace=$(df -h "$filesystem" | awk 'NR==2 {print $5}' | sed 's/%//') | |
| if [ "$usedspace" -ge $((100 - threshold)) ]; then | |
| echo -e "${RED}Warning: $usedspace% space is used on $filesystem!${NC}" | |
| df -h | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment