Fix cronjob. Remove free disk space on /storage
This commit is contained in:
@@ -51,17 +51,17 @@ case $CHOICE in
|
|||||||
1)
|
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/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 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)
|
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/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 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)
|
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/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 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
|
esac
|
||||||
|
|
||||||
|
|||||||
8
rc/rc.py
8
rc/rc.py
@@ -21,16 +21,10 @@ import os
|
|||||||
def remote_control():
|
def remote_control():
|
||||||
st_home = os.statvfs("/home")
|
st_home = os.statvfs("/home")
|
||||||
free_home = "%.2f" % float((st_home.f_bavail * st_home.f_frsize)/1.073741824e9)
|
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")):
|
if (request.POST.get("cardbackup")):
|
||||||
os.system("sudo /home/pi/little-backup-box/scripts/card-backup.sh")
|
os.system("sudo /home/pi/little-backup-box/scripts/card-backup.sh")
|
||||||
return ('Backup started. You can close this page.')
|
return ('Backup started. You can close this page.')
|
||||||
|
|
||||||
if (request.POST.get("camerabackup")):
|
if (request.POST.get("camerabackup")):
|
||||||
os.system("sudo /home/pi/little-backup-box/scripts/camera-backup.sh")
|
os.system("sudo /home/pi/little-backup-box/scripts/camera-backup.sh")
|
||||||
return ('Backup started. You can close this page.')
|
return ('Backup started. You can close this page.')
|
||||||
@@ -40,7 +34,7 @@ def remote_control():
|
|||||||
if (request.POST.get("shutdown")):
|
if (request.POST.get("shutdown")):
|
||||||
os.system("sudo shutdown -h now")
|
os.system("sudo shutdown -h now")
|
||||||
return ('Shutdown request sent. You can close this page.')
|
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')
|
@route('/static/:path#.+#', name='static')
|
||||||
def static(path):
|
def static(path):
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
<div id="content">
|
<div id="content">
|
||||||
<div id="header"><img src="static/ichigo.svg" height="39px" alt="Ichigo" align=""> Little Backup Box</div>
|
<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>/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>
|
<hr>
|
||||||
<p class="left">Back up a storage card connected via a card reader</p>
|
<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>
|
<p><input id="btn" name="cardbackup" type="submit" value="Card backup"></p>
|
||||||
|
|||||||
Reference in New Issue
Block a user