Skip to content

Instantly share code, notes, and snippets.

@rahulinux
Last active December 21, 2015 21:29
Show Gist options
  • Save rahulinux/6368235 to your computer and use it in GitHub Desktop.
Save rahulinux/6368235 to your computer and use it in GitHub Desktop.
Check if process is running or not ?
function checkprocess() {
local process=$1
[[ $# -ne 1 ]] && { echo "Usage: $0 process"; exit 1; }
if ps cax | grep -q $process; then
echo "Process is running."
else
echo "Process is not running."
fi
}
checkprocess $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment