Skip to content

Instantly share code, notes, and snippets.

@haeramkeem
Last active July 12, 2022 06:59
Show Gist options
  • Save haeramkeem/7c7ac0adbf5ccac8520d0d6f20063cfa to your computer and use it in GitHub Desktop.
Save haeramkeem/7c7ac0adbf5ccac8520d0d6f20063cfa to your computer and use it in GitHub Desktop.
Bash) checking process and systemd service
#!/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