3 changed files with 73 additions and 0 deletions
@ -0,0 +1,41 @@ |
|||||
|
#ofxPiMapper Scripts |
||||
|
|
||||
|
This directory contains useful scripts to be used to autorun and keep alive your projection mapping application. |
||||
|
|
||||
|
|
||||
|
## keepalive-example.sh |
||||
|
|
||||
|
This script launches and keeps alive the example application. |
||||
|
|
||||
|
1. Copy it to your home directory. |
||||
|
``` |
||||
|
cp keepalive-example.sh ~/keepalive-example.sh |
||||
|
``` |
||||
|
2. Set exec permissions. |
||||
|
``` |
||||
|
chmod a+x keepalive-example.sh |
||||
|
``` |
||||
|
3. Run `crontab -e` and add the following lines to make use of it. |
||||
|
``` |
||||
|
@reboot /home/pi/keepalive-example.sh |
||||
|
* * * * * /home/pi/keepalive-example.sh |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
## keepalive-example-camera.sh |
||||
|
|
||||
|
This script launches and keeps alive the example-camera application. |
||||
|
|
||||
|
1. Copy it to your home directory. |
||||
|
``` |
||||
|
cp keepalive-example-camera.sh ~/keepalive-example-camera.sh |
||||
|
``` |
||||
|
2. Set exec permissions. |
||||
|
``` |
||||
|
chmod a+x keepalive-example-camera.sh |
||||
|
``` |
||||
|
3. Run `crontab -e` and add the following lines to make use of it. |
||||
|
``` |
||||
|
@reboot /home/pi/keepalive-example-camera.sh |
||||
|
* * * * * /home/pi/keepalive-example-camera.sh |
||||
|
``` |
@ -0,0 +1,16 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
PROCESS_DIR="/home/pi/openFrameworks/addons/ofxPiMapper/example/bin" |
||||
|
PROCESS_NAME="example-camera" |
||||
|
|
||||
|
case "$(pidof $PROCESS_NAME | wc -w)" in |
||||
|
|
||||
|
0) echo "Restarting $PROCESS_NAME: $(date)" >> "/var/log/$PROCESS_NAME.txt" |
||||
|
"$PROCESS_DIR/$PROCESS_NAME" & |
||||
|
;; |
||||
|
1) # all ok |
||||
|
;; |
||||
|
*) echo "Removed double $PROCESS_NAME: $(date)" >> "/var/log/$PROCESS_NAME.txt" |
||||
|
kill $(pidof $PROCESS_NAME | awk '{print $1}') |
||||
|
;; |
||||
|
esac |
@ -0,0 +1,16 @@ |
|||||
|
#!/bin/bash |
||||
|
|
||||
|
PROCESS_DIR="/home/pi/openFrameworks/addons/ofxPiMapper/example/bin" |
||||
|
PROCESS_NAME="example" |
||||
|
|
||||
|
case "$(pidof $PROCESS_NAME | wc -w)" in |
||||
|
|
||||
|
0) echo "Restarting $PROCESS_NAME: $(date)" >> "/var/log/$PROCESS_NAME.txt" |
||||
|
"$PROCESS_DIR/$PROCESS_NAME" & |
||||
|
;; |
||||
|
1) # all ok |
||||
|
;; |
||||
|
*) echo "Removed double $PROCESS_NAME: $(date)" >> "/var/log/$PROCESS_NAME.txt" |
||||
|
kill $(pidof $PROCESS_NAME | awk '{print $1}') |
||||
|
;; |
||||
|
esac |
Loading…
Reference in new issue