www.numberspeaks.com

BLOG

Linux

Odoo 9 Linux bash backup script

Bash backup odoo script is available on GitHub for Odoo 8 and 11. This bash script will help you to backup Odoo database, set a password on the backup file and remove files older than 7 days. You’ll need curl and 7zip linux package to make it work. This example is backing up od11-01 and od11-02 databases. It’s not really optimized with the double compression. BACKUP_DIR=/opt/backup ODOO_DATABASES="od11-01 od11-02" ADMIN_PASSWORD="ODOO_DATABASE_MANAGER_PASSORD" FILE_PASSWORD="ZIP_FILE_PASSWORD" TIMESTAMP=`date +%Y-%m-%d_%H-%M-%S` for DB in ${ODOO_DATABASES} do # create a backup curl -X POST \ -F "master_pwd=${ADMIN_PASSWORD}" \ -F "name=${DB}" \ -F "backup_format=zip" \ -o ${BACKUP_DIR}/${DB}/${DB}.${TIMESTAMP}.zip \ http://localhost:8069/web/database/backup 7z a …

Mssql differential restoration error

After trying to restore differential backup after a full backup, i got this error message : The log or differential backup cannot be restored because no files are ready to roll forward. To be able to complete differential restoration, full backup needs to be restored with “WITH NORECOVERY” option as follow: RESTORE DATABASE numberspeaks FROM DISK = ‘D:\numberspeaks-full.bak’ WITH NORECOVERY RESTORE DATABASE numberspeaks FROM DISK = ‘D:\numberspeaks-diff.bak’ WITH RECOVERY

Fail2ban doesn’t ban but regex works

One of my Debian server with fail2ban has a problem to ban ip from brute force attack, however testing logs with fail2ban-regex worked perfectly. My solution has been found through this page. The cause of my issue was related to the timezone of the system. To solve this problem, i used the command bellow to reconfigure timezone and then fail2ban started to ban as usual. sudo dpkg-reconfigure tzdata

WordPress Code Display

Plugin for displaying code in the front end: http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/ code to use in the backend: [code lang=”xml”][/code]

zimbra

How to get the list of incoming connections with email addresses and geo localization in Zimbra

Bellow script will list incoming connections and remote ip geo localization of the server, it will search in logs file emails addresses related to the remote ip address. #!/bin/bash format="%30s %15s %20s %60s\n\n" header="%30s %15s %20s %60s\n" INFO=/tmp/info$1.tmp ZIMBRALOG=/var/log/zimbra.log* AUDITLOG=/opt/zimbra/log/audit.log* MAILBOXLOG=/opt/zimbra/log/mailbox.log* IPDB=ipinfo.io/ PORT=$1 COUNTER=0 echo "===========================================================" echo "Check connection on port $1" echo "===========================================================" echo "" printf "$header" "EMAIL" "IP" "COUNTRY" "HOSTNAME" echo "" IP=`netstat -an | grep ":$PORT " | grep "ESTABLISHED" | awk ‘{print $5}’ | cut -d ‘:’ -f1 | awk ‘!a[$0]++’` for i in $IP; do if [ $i != 0.0.0.0 ] && [[ $i != …