Various fixes and improvements

This commit is contained in:
Dmitri Popov
2019-02-11 20:37:39 +01:00
parent 93e7c890d5
commit 9c458c0e68
5 changed files with 33 additions and 47 deletions

View File

@@ -47,13 +47,11 @@ The exact steps depend on the backup mode.
### Remote control mode
1. Point the browser to *http://[IP-ADDRESS]:8080* (replace *[IP-ADDRESS]* with the actual IP address of the Raspberry Pi)
2. Start the desired backup mode by pressing the appropriate button.
1. Point the browser to *http://127.0.0.1:8000* (replace *127.0.0.1* with the actual IP address of the Raspberry Pi).
2. Start the desired action by pressing the appropriate button.
<img src="img/rc.png" alt="" />
The remote control mode gives you access to the **Device backup** action that backs up the */home/pi/BACKUP* folder on the Raspberry Pi to an external storage device. This can be useful when you transfer files in the camera backup mode, and later want to back up the transferred files to a external storage device.
## Problems?
Please report bugs and issues in the [Issues](https://github.com/dmpop/little-backup-box/issues) section.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -13,10 +13,26 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
echo "----------------------"
echo "Updating the system..."
echo "----------------------"
sudo apt update
sudo apt dist-upgrade -y
sudo apt update
sudo apt install acl git-core screen rsync exfat-fuse exfat-utils ntfs-3g gphoto2 libimage-exiftool-perl dialog php7.1 minidlna -y
echo "-----------------------------------"
echo "Installing the required packages..."
echo "-----------------------------------"
sudo apt install acl git-core screen rsync exfat-fuse exfat-utils ntfs-3g gphoto2 libimage-exiftool-perl dialog php minidlna -y
echo "Enter user name (e.g., pi) and press [ENTER]:"
read USERNAME
if [ -z "$USERNAME" ]; then
USERNAME="pi"
fi
echo "------------------------------------"
echo "Creating the required directories..."
@@ -24,13 +40,9 @@ echo "------------------------------------"
sudo mkdir /media/card
sudo mkdir /media/storage
sudo chown -R $USER:users /media/storage
sudo chown -R $USERNAME:users /media/storage
sudo chmod -R 775 /media/storage
sudo setfacl -Rdm g:$USER:rw /media/storage
echo "-----------------------"
echo "Configuring minidlna..."
echo "-----------------------"
sudo setfacl -Rdm g:$USERNAME:rw /media/storage
sudo sed -i 's|'media_dir=/var/lib/minidlna'|'media_dir=/media/storage'|' /etc/minidlna.conf
sudo service minidlna start
@@ -64,19 +76,19 @@ CHOICE=$(dialog --clear \
clear
case $CHOICE in
1)
crontab -l | { cat; echo "#@reboot sudo /home/"$USER"/little-backup-box/scripts/card-backup.sh >> /home/"$USER"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "#@reboot sudo /home/"$USER"/little-backup-box/scripts/camera-backup.sh >> /home/"$USER"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "@reboot sudo /home/"$USER"/little-backup-box/scripts/php.sh >> /home/"$USER"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "#@reboot sudo /home/"$USERNAME"/little-backup-box/scripts/card-backup.sh >> /home/"$USERNAME"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "#@reboot sudo /home/"$USERNAME"/little-backup-box/scripts/camera-backup.sh >> /home/"$USERNAME"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "@reboot cd /home/"$USERNAME"/little-backup-box/scripts && sudo php -S 0.0.0.0:8000"; } | crontab
;;
2)
crontab -l | { cat; echo "@reboot sudo /home/"$USER"/little-backup-box/scripts/card-backup.sh >> /home/"$USER"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "#@reboot sudo /home/"$USER"/little-backup-box/scripts/camera-backup.sh >> /home/"$USER"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "#@reboot sudo /home/"$USER"/little-backup-box/scripts/php.sh >> /home/"$USER"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "@reboot sudo /home/"$USERNAME"/little-backup-box/scripts/card-backup.sh >> /home/"$USERNAME"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "#@reboot sudo /home/"$USERNAME"/little-backup-box/scripts/camera-backup.sh >> /home/"$USERNAME"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "#@reboot cd /home/"$USERNAME"/little-backup-box/scripts && sudo php -S 0.0.0.0:8000"; } | crontab
;;
3)
crontab -l | { cat; echo "#@reboot sudo /home/"$USER"/little-backup-box/scripts/card-backup.sh >> /home/"$USER"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "@reboot sudo /home/"$USER"/little-backup-box/scripts/camera-backup.sh >> /home/"$USER"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "#@reboot sudo /home/"$USER"/little-backup-box/scripts/php.sh >> /home/"$USER"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "#@reboot sudo /home/"$USERNAME"/little-backup-box/scripts/card-backup.sh >> /home/"$USERNAME"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "@reboot sudo /home/"$USERNAME"/little-backup-box/scripts/camera-backup.sh >> /home/"$USERNAME"/little-backup-box.log 2>&1"; } | crontab
crontab -l | { cat; echo "#@reboot cd /home/"$USERNAME"/little-backup-box/scripts && sudo php -S 0.0.0.0:8000"; } | crontab
;;
esac

View File

@@ -47,14 +47,14 @@
<?php
if (isset($_POST['cardbackup']))
{
shell_exec('sudo ./card-backup.sh');
shell_exec('sudo ./card-backup.sh 2>&1 & echo $!');
}
if (isset($_POST['camerabackup']))
{
shell_exec('sudo ./camera-backup.sh');
shell_exec('sudo ./camera-backup.sh 2>&1 & echo $!');
}
if (isset($_POST['shutdown']))
{
shell_exec('sudo shutdown -h now');
shell_exec('sudo shutdown -h now 2>&1 & echo $!');
}
?>

View File

@@ -1,24 +0,0 @@
#!/bin/bash
#!/usr/bin/env bash
# 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 <http://www.gnu.org/licenses/>.
while :
do
if [[ ! $(pgrep php) ]]; then
cd /home/$USER/little-backup-box/script/
php -S localhost:8000
fi
done