Skip to content

Instantly share code, notes, and snippets.

@inspiretk
Last active December 5, 2021 16:25
Show Gist options
  • Save inspiretk/874ba6ba83a1fe62944d1b90d4e1f072 to your computer and use it in GitHub Desktop.
Save inspiretk/874ba6ba83a1fe62944d1b90d4e1f072 to your computer and use it in GitHub Desktop.
https://github.com/Yenthe666/auto_backup
backup to server first
sudo pip3 install pysftp
# this is no good, it needs List_db to be True, but it's disabled for security purpose. Need another method.
https://github.com/meganz/MEGAcmd/blob/master/contrib/docs/BACKUPS.md
push local backup to mega cloud
https://github.com/meganz/MEGAcmd/blob/master/UserGuide.md
https://github.com/meganz/MEGAcmd
git clone https://github.com/meganz/MEGAcmd.git
git submodule update --init --recursive
sh autogen.sh
./configure
make
make install
https://collectivepi.wordpress.com/2017/03/27/megacmd-a-command-line-client-for-mega-nz-storage-service/
cd
mkdir -p ~/bin && echo "PATH=\$HOME/bin:\$PATH" >> ~/.bashrc && source ~/.bashrc
wget https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz
tar xvf go1.3.3.linux-amd64.tar.gz
cp ~/go/bin/* ~/bin/
git clone https://github.com/t3rm1n4l/megacmd.git
cd megacmd
GOROOT="${HOME}/go" make
cp megacmd ~/bin/
https://www.seedhost.eu/whmcs/knowledgebase/227/megacmd-installation.html
mkdir -p ~/bin && echo "PATH=\$HOME/bin:\$PATH" >> ~/.bashrc && source ~/.bashrc
cd && wget -q https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz
tar xvf go1.3.3.linux-amd64.tar.gz
cd && git clone https://github.com/t3rm1n4l/megacmd.git
cp ~/go/bin/* ~/bin/
cd ~/megacmd
GOROOT=$HOME/go make
cp megacmd ~/bin/
https://whatbox.ca/wiki/megacmd
https://github.com/meganz/MEGAcmd
git clone https://github.com/meganz/MEGAcmd.git
git submodule update --init --recursive
Building and installing
sh autogen.sh
./configure
make
make install
# You will need to run make install as root. To disable MEGAcmd use configure with --disable-megacmd
sudo apt-get install curl -y
# Create bash script to backup database, and send it to mega
https://linuxize.com/post/how-to-setup-automatic-odoo-backup/
nano backup_odoo.sh
#### Copy below script. Put this script in root, in a secure folder ####
#!/bin/bash
# vars
BACKUP_DIR=~/odoo_backups
ODOO_DATABASE=db1
ADMIN_PASSWORD=superadmin_passwd
#activate database url
sudo sed -i 's/list_db=False/list_db=True/g' /etc/odoo-server.conf
sudo service odoo-server restart
# create a backup directory
mkdir -p ${BACKUP_DIR}
# create a backup
curl -X POST \
-F "master_pwd=${ADMIN_PASSWORD}" \
-F "name=${ODOO_DATABASE}" \
-F "backup_format=zip" \
-o ${BACKUP_DIR}/${ODOO_DATABASE}.$(date +%F).zip \
https://thuani.com/web/database/backup
# delete old backups
find ${BACKUP_DIR} -type f -mtime +7 -name "${ODOO_DATABASE}.*.zip" -delete
# deactivate database url
sudo sed -i 's/list_db=True/list_db=False/g' /etc/odoo-server.conf
sudo service odoo-server restart
############ End of file ############
sudo chmod +x ~/backup_odoo.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment