Skip to content

Instantly share code, notes, and snippets.

@LoveDuckie
Created June 23, 2023 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LoveDuckie/1a1d4e4ad31807060a5de83a09a5e47d to your computer and use it in GitHub Desktop.
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.
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