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 …

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]

Protect Jasper PDF report by a password

To do so, just add in the xml file of your report those following lines <property name="net.sf.jasperreports.export.pdf.encrypted" value="True"/> <property name="net.sf.jasperreports.export.pdf.128.bit.key" value="True"/> <property name="net.sf.jasperreports.export.pdf.user.password" value="mySuperPass"/> <property name="net.sf.jasperreports.export.pdf.owner.password" value="mySuperPass"/> JasperServer Community 6.0.1 Jaspersoft Studio 6.0.1

Problem with Godaddy VPS upgrade

I recently had a problem with Godaddy ubuntu 16.04 VPS, after updating and upgrading the system: apt-get update apt-get upgrade reboot SSH port wasn’t anymore reachable, it’s the only access we have to the server, however other services are working normally, so the system is still running. I tried many times to restart, call the support, but it didn’t solve the problem. The only solution was to destroy the server and rebuild it from scratch + restoration of backups. I’ve also tested the upgrade with a clean and freshly installed system, same issue occurred. If you’re running Ubuntu 16.04 VPS …

zimbra

DKIM Zimbra 8.6

DKIM is an email authentication method designed to detect email spoofing, for more detail : Wiki DKIM, i’m describing in this post how to enable it with Zimbra. Make sure your DKIM has been enabled in your mail server. su – zimbra /opt/zimbra/libexec/zmdkimkeyutil -a -d domain.com 148ERADC-FCE5-11E6-AF44-005A1B26B745._domainkey IN TXT ( "v=DKIM1; k=rsa; " "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDg2uVLIssdfsfgu62+c7n0sxugzm8Lpr4A7o7veL4kIeifat2hD53P2KKQTV978HxBTQKrEFByLbG0WZuNracNJU9L5NOKtmYnE7ksxF9ODMKqFK+ltsmM9qkVxbU3xQOVdufDlV2Zk8Ya0WMkYWzKgWIwIDAQAB" ) ; —– DKIM key 148ERADC-FCE5-11E6-AF44-005A1B26B745 for domain.com Add DNS TXT record: 148ERADC-FCE5-11E6-AF44-005A1B26B745._domainkey IN TXT v=DKIM1; k=rsa;p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDg2uVLIssdfsfgu62+c7n0sxugzm8Lpr4A7o7veL4kIeifat2hD53P2KKQTV978HxBTQKrEFByLbG0WZuNracNJU9L5NOKtmYnE7ksxF9ODMKqFK+ltsmM9qkVxbU3xQOVdufDlV2Zk8Ya0WMkYWzKgWIwIDAQAB Test DKIM signature by sending email using this website: http://dkimvalidator.com/

How to use datetime in Python

  Exemple 1 : subtract 2 dates from datetime import datetime, date, timedelta date_1 = datetime.strptime(‘2018-06-01’, "%Y-%m-%d") date_2 = datetime.strptime(‘2018-06-04’, "%Y-%m-%d") diff_date = date_2 – date_1 print(diff_date.days) run the command. python3 -m script script.py root@numberspeaks.com:~#3 Exemple 2 : add or subtract days to a date from datetime import datetime, date, timedelta date_1 = datetime.strptime(‘2018-06-01’, "%Y-%m-%d") new_date = date_1 + timedelta(days=4) print(new_date) run the command. python3 -m script script.py root@numberspeaks.com:~#2018-06-05 00:00:00 Exemple 3 : today date from datetime import datetime, date, timedelta today_date = datetime.today() Exemple 4 : convert string to datetime from datetime import datetime, date, timedelta date = datetime.strptime(‘2018-06-01’, …