#!/usr/bin/python # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . from bottle import post, route, request, run import os @route('/') @route('/', method='POST') def control(): if (request.POST.get("cardbackup")): os.system("sudo /home/pi/little-backup-box/backup.sh") if (request.POST.get("camerabackup")): os.system("sudo /home/pi/little-backup-box/backup.sh") if (request.POST.get("shutdown")): os.system("sudo shutdown -h now") return """ Little Backup Box

Press Card backup to back up a storage card connected via a card reader.

Press Camera backup to transfer files directly from the connected camera.

Press Shutdown to shut down the Little Backup Box.

""" run(host="0.0.0.0",port=8080, debug=True, reloader=True)