Skip to content

Commit

Permalink
- move backup module config.cfg file creation to backup module instal…
Browse files Browse the repository at this point in the history
…lation script

- call on backup module install.sh for both installation and update
  • Loading branch information
TrystanLea committed Jan 17, 2020
1 parent 063a755 commit 960326d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 32 deletions.
17 changes: 0 additions & 17 deletions install/emoncms_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,5 @@ for module in ${!symlinked_emoncms_modules[@]}; do
fi
done

# backup module
if [ -d $emoncms_dir/modules/backup ]; then
cd $emoncms_dir/modules/backup
if [ ! -f config.cfg ]; then
cp default.config.cfg config.cfg
sed -i "s~USER~$user~" config.cfg
sed -i "s~BACKUP_SCRIPT_LOCATION~$emoncms_dir/modules/backup~" config.cfg
sed -i "s~EMONCMS_LOCATION~$emoncms_www~" config.cfg
sed -i "s~BACKUP_LOCATION~$emoncms_datadir/backup~" config.cfg
sed -i "s~DATABASE_PATH~$emoncms_datadir~" config.cfg
sed -i "s~EMONHUB_CONFIG_PATH~/etc/emonhub~" config.cfg
sed -i "s~EMONHUB_SPECIMEN_CONFIG~$openenergymonitor_dir/emonhub/conf~" config.cfg
sed -i "s~BACKUP_SOURCE_PATH~$emoncms_datadir/backup/uploads~" config.cfg
fi
cd
fi

echo "Update Emoncms database"
php $openenergymonitor_dir/EmonScripts/common/emoncmsdbupdate.php
20 changes: 5 additions & 15 deletions update/emoncms_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,11 @@ for M in $emoncms_dir/modules/*; do
fi
done

# backup module
if [ -d $emoncms_dir/modules/backup ]; then
cd $emoncms_dir/modules/backup
if [ ! -f config.cfg ]; then
cp default.config.cfg config.cfg
sed -i "s~USER~$user~" config.cfg
sed -i "s~BACKUP_SCRIPT_LOCATION~$emoncms_dir/modules/backup~" config.cfg
sed -i "s~EMONCMS_LOCATION~$emoncms_www~" config.cfg
sed -i "s~BACKUP_LOCATION~$openenergymonitor_dir/data~" config.cfg
sed -i "s~DATABASE_PATH~$emoncms_datadir~" config.cfg
sed -i "s~EMONHUB_CONFIG_PATH~/etc/emonhub~" config.cfg
sed -i "s~EMONHUB_SPECIMEN_CONFIG~$openenergymonitor_dir/emonhub/conf~" config.cfg
sed -i "s~BACKUP_SOURCE_PATH~$openenergymonitor_dir/data/uploads~" config.cfg
fi
cd
# run module install (& update) script if present
module=backup
if [ -f $emoncms_dir/modules/$module/install.sh ]; then
$emoncms_dir/modules/$module/install.sh $openenergymonitor_dir
echo
fi

echo "Update Emoncms database"
Expand Down

0 comments on commit 960326d

Please sign in to comment.