Fix cronjob. Remove free disk space on /storage

This commit is contained in:
Dmitri Popov
2018-03-28 19:53:25 +02:00
parent 2f8ea00ec3
commit 4c532d2072
3 changed files with 4 additions and 11 deletions

View File

@@ -51,17 +51,17 @@ case $CHOICE in
1)
crontab -l | { cat; echo "#@reboot sudo /home/pi/little-backup-box/scripts/card-backup.sh"; } | crontab
crontab -l | { cat; echo "#@reboot sudo /home/pi/little-backup-box/scripts/camera-backup.sh"; } | crontab
crontab -l | { cat; echo "@reboot cd /home/pi/little-backup-box/rc ; sudo python3 rc.py"; } | crontab
crontab -l | { cat; echo "@reboot cd /home/pi/little-backup-box/rc && sudo python3 rc.py"; } | crontab
;;
2)
crontab -l | { cat; echo "@reboot sudo /home/pi/little-backup-box/scripts/card-backup.sh"; } | crontab
crontab -l | { cat; echo "#@reboot sudo /home/pi/little-backup-box/scripts/camera-backup.sh"; } | crontab
crontab -l | { cat; echo "#@reboot cd /home/pi/little-backup-box/rc ; sudo python3 rc.py"; } | crontab
crontab -l | { cat; echo "#@reboot cd /home/pi/little-backup-box/rc && sudo python3 rc.py"; } | crontab
;;
3)
crontab -l | { cat; echo "#@reboot sudo /home/pi/little-backup-box/scripts/card-backup.sh"; } | crontab
crontab -l | { cat; echo "@reboot sudo /home/pi/little-backup-box/scripts/camera-backup.sh"; } | crontab
crontab -l | { cat; echo "#@reboot cd /home/pi/little-backup-box/rc ; sudo python3 rc.py"; } | crontab
crontab -l | { cat; echo "#@reboot cd /home/pi/little-backup-box/rc && sudo python3 rc.py"; } | crontab
;;
esac

View File

@@ -21,16 +21,10 @@ import os
def remote_control():
st_home = os.statvfs("/home")
free_home = "%.2f" % float((st_home.f_bavail * st_home.f_frsize)/1.073741824e9)
if os.path.isdir("/media/storage"):
st_storage = os.statvfs("/media/storage")
free_storage = "%.2f" % float((st_storage.f_bavail * st_storage.f_frsize)/1.073741824e9)
else:
free_storage="N/A"
if (request.POST.get("cardbackup")):
os.system("sudo /home/pi/little-backup-box/scripts/card-backup.sh")
return ('Backup started. You can close this page.')
if (request.POST.get("camerabackup")):
os.system("sudo /home/pi/little-backup-box/scripts/camera-backup.sh")
return ('Backup started. You can close this page.')
@@ -40,7 +34,7 @@ def remote_control():
if (request.POST.get("shutdown")):
os.system("sudo shutdown -h now")
return ('Shutdown request sent. You can close this page.')
return template('rc.tpl', freespace_home=free_home, freespace_storage=free_storage)
return template('rc.tpl', freespace_home=free_home)
@route('/static/:path#.+#', name='static')
def static(path):

View File

@@ -47,7 +47,6 @@
<div id="content">
<div id="header"><img src="static/ichigo.svg" height="39px" alt="Ichigo" align=""> Little Backup Box</div>
<p class="center">Free disk space on <i>/home</i>: <b>{{freespace_home}}</b> GB</p>
<p class="center">Free disk space on <i>/storage</i>: <b>{{freespace_storage}}</b> GB</p>
<hr>
<p class="left">Back up a storage card connected via a card reader</p>
<p><input id="btn" name="cardbackup" type="submit" value="Card backup"></p>