Last active
July 12, 2022 06:59
-
-
Save haeramkeem/7c7ac0adbf5ccac8520d0d6f20063cfa to your computer and use it in GitHub Desktop.
Bash) checking process and systemd service
This file contains 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
#!/bin/bash | |
# Check if process is running | |
ps aux | grep -v grep | grep ${PROCESS_NAME} | |
killall -0 ${PROCESS_NAME} | |
pgrep ${PROCESS_NAME} | |
# Check if systemd service is active | |
# @see https://unix.stackexchange.com/a/396638 | |
systemctl is-active ${SERVICE_NAME} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment