Skip to content

Instantly share code, notes, and snippets.

@meub
Created March 4, 2020 16:54
Show Gist options
  • Save meub/841f37de43ac954e6b32dcf039f1528e to your computer and use it in GitHub Desktop.
Save meub/841f37de43ac954e6b32dcf039f1528e to your computer and use it in GitHub Desktop.
Bash script to check if Pi servo process is running
#!/bin/bash
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
if ps -aux | grep -v grep | grep "pi-servo.py" >/dev/null
then
echo "Process is running."
else
echo "Process is not running. Starting it up..."
python3 /home/pi/pi-servo.py
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment