Posts

Showing posts from June, 2016

Quote of the day

"Fallor Ergo Sum - I err therefore I am"

~St. Augustine.

Backup a host in BackupPC when PING was blocked on your network

When PING was blocked on your network, BackupPC can not backup hosts because it will stop the backup process when there is no ping response. Here is a workaround to make the backup happen:

Change the PingCMD (ping command) in the host setting of BackupPC webinterface:

1. Seclect the host then click "Edit Config" link.

2. In Backup Settings tab, PingCMD section, check "Override" and replace 

"$pingPath -c 1 $host" 
with
"/bin/echo"

3. Click "Save"

Get activated theme on every site in WordPress Multisite using Python

This is a more precise way to get the list of activated theme on each blog in your WordPress Multisite:

Get activated theme on every site in WordPress Multisite using wp-cli

You can use this:

1. Install wp-cli.

2. Create a bash script (export_blog_theme.sh) with the following content

#! /bin/bash

for url in $(wp site list --field=url --path=/path/to/your/wordpress/root)
do
        theme=$(wp option get template --url="$url" --path=/path/to/your/wordpress/root)
        echo "$url,$theme"
done


3. Make script executable:

$ sudo chmod +x export_blog_theme.sh

4. Run the script:

$ sudo -u www-data ./export_blog_theme.sh > blog_theme_list.csv


Notes: Sometimes, the script return no result because of caches or WordPress db connection limitation.



The kitchen

Image
Stop and Go Boutique Hotel, Da Lat, June 15th 2016.

Morning from the balcony

Image
Stop and Go Boutique HotelDa Lat, June 15th 2016.

The "breakfast" garden

Image
Stop and Go Boutique Hotel, Da Lat, June 15th 2016.

How many processes running on your Linux server?

Find out by:

$ ps -A --no-headers | wc -l

or

$ ps -AL --no-headers | wc -l

PHP5-FPM error "Fatal Error Unable to allocate shared memory segment"

I just got this error this morning when trying to run some php shell script:

"Fatal Error Unable to allocate shared memory segment"

I followed this following trick and it seemed to work:

1. Use ipcs -lm to determine current shared memory limits. And use ipcs -ma to determine how much shared memory is currently in use.

2. Increase maximum shared memory segment size from 32MB to 128MB.

echo "134217728" >/proc/sys/kernel/shmmax
echo "134217728" >/proc/sys/kernel/shmall

And then retry.

3. If php5-fpm then works ok, make the change survive reboots, by placing an entry in /etc/sysctl.conf as below:

kernel.shmmax=134217728
kernel.shmall=134217728

Scheduling VMWare virtual machines backup with Veeam Backup Free v9 and PowerShell

The Veeam Backup Free v9 is quite good but it lacks of scheduling the backup task. Fortunately, it supports powershell so you can leverage this following script to backup vms without upgrading to the Pro version:

1. Download and Install Veeam Backup & Replication Free v9 in a Windows machine (It's Windows Server 2008 R2 in my case):

https://www.veeam.com/virtual-machine-backup-solution-free.html

Note that It may require you to install Microsoft .NET framework 4.5.2 and Microsoft SQL Server 2012 Express if your server does not have them.

2. Install PowerShell v3, it's Windows Management Framework 3.0 (the script works best with PowerShell v3):

https://www.microsoft.com/en-us/download/details.aspx?id=34595

for Windows Server 2008 R2, I installed the Windows6.1-KB2506143-x64.msu package.

3. Download this file and edit it with your own information (server name, email settings...)



4. Create a schedule task to run the script every weekend at 1AM for example. Everytime the backup finis…

Convert CR2 RAW image into JPG in Ubuntu

Just use this command:

for i in *.CR2; do dcraw -c -a -h $i | ppmtojpeg > `basename $i CR2`JPG; echo $i done; done

How to solve the ORA-10873 error message of Oracle

When I's trying to startup my Oracle instance with this method because It got the "ORA-01109 Database not open" error. I encountered another error:

ORA-10873 file 1 needs to be either taken out of backup mode or media recovered

Here is how I solved it. From the command prompt:

sqlplus /@MYDBINSTANCE as sysdba

STARTUP MOUNT
SELECT * FROM V$BACKUP
ALTER DATABASE END BACKUP
ALTER DATABASE OPEN