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

@@ -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):