Skip to content

Instantly share code, notes, and snippets.

@chrdek
Last active August 15, 2020 17:24
Show Gist options
  • Save chrdek/06995686fa5ed36baae9ab3e731ba79d to your computer and use it in GitHub Desktop.
Save chrdek/06995686fa5ed36baae9ab3e731ba79d to your computer and use it in GitHub Desktop.
Terminate process for pins from shell
#!/bin/bash
GPIO_PIN=10
# stop gpio pins, relevant cmd process
ctrl_c() {
echo "0" > "/sys/class/gpio/gpio${GPIO_PIN}/value"
echo $GPIO_PIN > /sys/class/gpio/unexport
exit
}
# set appropriate OS signal for ctrl-c command
trap ctrl_c SIGINT
#!/tmp/crontab.ppPynM/crontab
# cron format supported
# minutes hours daymonth dayweek [-optional year] command
*/5 * * * * bash ~/bin/sh/gpioterm.sh >> /home/pi/handlerpiStatus.txt 2>&1
0 0 * * * rm /home/pi/handlerpiStatus.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment