Fixes and cleanup

This commit is contained in:
Dmitri Popov
2018-03-19 20:19:20 +01:00
parent 43f6754e4c
commit 9e5026c4d7
2 changed files with 3 additions and 7 deletions

View File

@@ -22,16 +22,12 @@ done
# Create the target directory with the camera model as its name # Create the target directory with the camera model as its name
CAMERA=$(gphoto2 --summary | grep "Model" | cut -d: -f2 | tr -d '[:space:]') CAMERA=$(gphoto2 --summary | grep "Model" | cut -d: -f2 | tr -d '[:space:]')
STORAGE_MOUNT_POINT="$HOME_DIR/$CAMERA" STORAGE_MOUNT_POINT="$HOME_DIR/$CAMERA"
mkdir -p $STORAGE_MOUNT_POINT
# Set the ACT LED to blink at 500ms to indicate that the camera has been detected
sudo sh -c "echo 500 > /sys/class/leds/led0/delay_on"
# Switch to STORAGE_MOUNT_POINT and transfer files from the camera # Switch to STORAGE_MOUNT_POINT and transfer files from the camera
# Rename the transferred files using the YYYYMMDD-HHMMSS format # Rename the transferred files using the YYYYMMDD-HHMMSS format
cd $STORAGE_MOUNT_POINT cd $STORAGE_MOUNT_POINT
gphoto2 --get-all-files --skip-existing --filename=%Y%m%d-%H%M%S.%C gphoto2 --get-all-files --skip-existing --filename=%Y%m%d-%H%M%S.%C
# Turn off the ACT LED to indicate that the backup is completed
sudo sh -c "echo 0 > /sys/class/leds/led0/brightness"
# Shutdown # Shutdown
shutdown -h now shutdown -h now

View File

@@ -11,8 +11,8 @@ sudo setfacl -Rdm g:pi:rw /media/storage
cd cd
git clone https://github.com/dmpop/little-backup-box.git git clone https://github.com/dmpop/little-backup-box.git
crontab -l | { cat; echo "@reboot sudo /home/pi/little-backup-box/backup.sh > /home/pi/little-backup-box.log"; } | crontab crontab -l | { cat; echo "@reboot sudo /home/pi/little-backup-box/backup.sh"; } | crontab
crontab -l | { cat; echo "#@reboot sudo /home/pi/little-backup-box/gphoto-backup.sh > /home/pi/gphoto-backup.log"; } | crontab crontab -l | { cat; echo "#@reboot sudo /home/pi/little-backup-box/gphoto-backup.sh"; } | crontab
sudo sed -i 's|'media_dir=/var/lib/minidlna'|'media_dir=/media/storage'|' /etc/minidlna.conf sudo sed -i 's|'media_dir=/var/lib/minidlna'|'media_dir=/media/storage'|' /etc/minidlna.conf
sudo service minidlna start sudo service minidlna start