Browse Source

Update startup script for image generator

master
Krisjanis Rijnieks 6 years ago
parent
commit
f081e08981
  1. 49
      scripts/startup.sh

49
scripts/startup.sh

@ -1,25 +1,38 @@
#!/bin/bash #!/bin/bash
PROCESS_DIR="/home/pi/openFrameworks/addons/ofxPiMapper/example/bin" OFX_DIR="ofx"
PROCESS_NAME="example"
case "$(pidof $PROCESS_NAME | wc -w)" in cd /home/pi/${OFX_DIR}/addons/ofxPiMapper/example_basic/bin/data/sources
0) echo "Restarting $PROCESS_NAME: $(date)" >> "/var/log/$PROCESS_NAME.txt" # Create temp dirs for default sources
mkdir videos_temp
mkdir images_temp
for i in {5..1}; # Move default sources to temp dirs
do mv videos/gene* videos_temp/
echo -en "\rLaunching ofxPiMapper in $i" mv images/gene* images_temp/
sleep 1;
done
echo -e "\r" # Delete non-default sources
rm videos/*
rm images/*
"$PROCESS_DIR/$PROCESS_NAME" & # Move default sources back
;; mv videos_temp/* videos/
1) # all ok mv images_temp/* images/
;;
*) echo "Removed double $PROCESS_NAME: $(date)" >> "/var/log/$PROCESS_NAME.txt" # Clean temp dirs
kill $(pidof $PROCESS_NAME | awk '{print $1}') rmdir videos_temp
;; rmdir images_temp
esac
# Copy valid video sources
cp /media/usb*/*.mp4 videos/
cp /media/usb*/*.mov videos/
cp /media/usb*/*.mkv videos/
# Copy valid image source
cp /media/usb*/*.jpg images/
cp /media/usb*/*.jpeg images/
cp /media/usb*/*.png images/
# Finally, launch mapper
/home/pi/${OFX_DIR}/addons/ofxPiMapper/example_basic/bin/example_basic

Loading…
Cancel
Save