-
-
Save yasmanycastillo/aca6652bf0494eee6f4d6b752509c78a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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