Created
June 23, 2023 10:34
-
-
Save LoveDuckie/1a1d4e4ad31807060a5de83a09a5e47d to your computer and use it in GitHub Desktop.
A simple script for determining whether a process is running on the local system.
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
is_process_running() { | |
if [ -z "$1" ]; then | |
write_error "shared_functions" "The process ID was not defined as the first parameter." | |
fi | |
if ps -p $1 >/dev/null; then | |
return 0 | |
fi | |
return 1 | |
} | |
if is_process_running 123; then | |
echo "123 is running" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment