diff --git a/backup/backup_controller.php b/backup/backup_controller.php index f9bcea4..b901f53 100644 --- a/backup/backup_controller.php +++ b/backup/backup_controller.php @@ -81,15 +81,7 @@ function backup_controller() if ((move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) && ($uploadOk == 1)) { - $fh = @fopen($import_flag,"w"); - if (!$fh) { - $result = "ERROR: Can't write the flag $import_flag."; - } else { - fwrite($fh,"$import_script>$import_logfile"); - $result = "Backup flag set"; - } - @fclose($fh); - + $redis->rpush("service-runner","$import_script $import_flag>$import_logfile"); header('Location: '.$path.'backup'); } else { $result = "Sorry, there was an error uploading the file"; diff --git a/emoncms-export.sh b/emoncms-export.sh index 6b5409f..b56012e 100755 --- a/emoncms-export.sh +++ b/emoncms-export.sh @@ -96,13 +96,7 @@ if [ $? -ne 0 ]; then fi # Append database folder to the archive with absolute path -tar -rv --file=$backup_location/emoncms-backup-$date.tar -C $mysql_path phpfina phptimeseries 2>&1 -if [ $? -ne 0 ]; then - echo "Error: failed to tar mysql dump and data" - echo "emoncms export failed" - sudo service feedwriter start > /dev/null - exit 1 -fi +tar -vr --file=$backup_location/emoncms-backup-$date.tar -C $mysql_path phpfina phptimeseries # Compress backup echo "Compressing archive..." diff --git a/readme.md b/readme.md index 2068872..30e4904 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,3 @@ - ## Emoncms backup export and import tool for backup and migration * Export a compressed archive containing Emoncms Inputs, Feed data, Dashboards & config. @@ -48,7 +47,10 @@ Follow on screen prompts, RasPi will shutdown when process is compleate. It can git clone https://github.com/emoncms/backup.git ln -s /home/pi/backup/backup/ /var/www/emoncms/Modules/backup -**Note: Ensure you are running the latest version of Emoncms on the Stable branch. [A change was merged on the 9th Feb 16 to Emoncms core](https://github.com/emoncms/emoncms/commit/e83ad78e6155275d7537104367b8d44ef63d78fe) that enables symlinked modules which is essential for backup module to appear in Emoncms** +**Note: + +- Ensure you are running the latest version of Emoncms on the Stable branch. [A change was merged on the 9th Feb 16 to Emoncms core](https://github.com/emoncms/emoncms/commit/e83ad78e6155275d7537104367b8d44ef63d78fe) that enables symlinked modules which is essential for backup module to appear in Emoncms** +- As of June 18 Backup module requires Redis to set service runner flags **If your running the older 'low-write' branch of Emoncms emonSD-17Jun15 or before then you won't be able to update to the latest version to enable symlinks, to get around this after installing the module browse to [http://emonpi/emoncms/backup](http://emonpi/emoncms/backup)** @@ -76,20 +78,21 @@ In order to enable uploads of backup zip files we need to set the maximum upload If running php5 +If using php5 + sudo nano /etc/php5/apache2/php.ini -If rnnning php5 (Stretch onwards) +If runnning php7 (Stretch onwards) + sudo nano /etc/php/7.0/apache2/php.ini - Use `[CTRL + W]` to search test Set: - memory_limit = 1056M - post_max_size = 1G - upload_max_filesize = 1G + post_max_size = 3G + upload_max_filesize = 3G # Create uploads folder