Monday, August 17, 2015

Sample bash backup script

I made a backup script using bash, this script will backup html directory and skip some folder that do not need to be included. The backup process will be written in the log file, so that we know whether backup running successfully or not.

Variable that needed to be changed:
LOG: the log file.
TEMPDIR: temporary directory
BKPDIR: directory to save the back up files
WWWDIR: parent directory that needed to be backed up
BKP: list of directory that will be backed up
NOTBKP: list directory that will not be backed up

Second synchronized disk with drbd, corosync and pacemaker

A couple years a go, I configured a Fail Over system using DRBD, Corosync and Pacemaker with this tutorial. After years, I need more disk space on the system and also make it synchronize each other. So here I show the configuration example for that, if you want to adapt this configuration into your system, just make sure that you start the service in a correct order within crm console because if not, your Fail Over system will not work correctly.

Hacking TL-WA901N v2 AP into a Wifi Router

A TP-Link TL-WA901N/ND v2 is an Access Point, you can use this AP as Wifi client, WDS or standard repeater and bridge. I have this AP and had been used for repeater for several years without problems. But now, I want to use this AP as a wifi router because my existing router is quiet old and only support wireless G. Of course, there is no official firmware that can change this AP into wifi router. So, I decided to try an opensource firmware for this task.

Sunday, November 09, 2014

Video and Audio Streaming from A20SOM-EVB using crtmpserver

To stream video and audio from A20SOM-EVB, ffmpeg and crtmpserver are used. FFmpeg is used to encode the video and audio from A20SOM-EVB csi-camera and mic-in and then feed the stream to crtmpserver. Crtmpserver act as streaming server to provide rtmp stream for flash player, or rtsp stream for video player such as videolan.

If the csi camera is not yet functioning on the default debian distro, please follow my previous article how to enable csi-camera on A20SOM-EVB.

Friday, November 07, 2014

System info on MOD-LCD3310 for Olimex A20SOM-EVB

To show the system information and other information on MOD-LCD3310, we can use python library. I found the implementation from this project and made a little modification to show ip address of wifi interface.

I also add one function to automatically cut the text and write it on the next line.
The function is longstr(linenumber,string). Example :
lcd.longstr(0,"Welcome to Open Hardware world!")

Wednesday, October 01, 2014

enable csi camera on A20-SOM EVB

The csi camera on the debian image with kernel 3.4.79+ from olimex doesn't work. To make it works, we need to change the configuration in script.bin and /etc/modules. We must convert script.bin to script.fex using bin2fex tools to change the configuration.
olimex@a20-Lime2-SOM:~$ bin2fex script.bin script.fex
We will have script.fex file after that command. Open the file and change the value as below:
csi_used = 1
Convert back script.fex to script.bin.
olimex@a20-Lime2-SOM:~$ fex2bin script.fex script.bin
Add the following value in the /etc/modules file:
sun4i_csi0 i2c_addr=0x78 ccm="gt2005"
After that, we can reboot the board. Wait a couple second, and voila...the csi camera will now work.
But there is still error message from the kernel log as follow:
[CSI_ERR]input index invalid!
Nevertheless, the csi camera works fine, if someone know how to solve this error, please let me know.

Friday, May 30, 2014

MySQL Apache Failover System with DRBD, Pacemaker, Corosync 2.x


The configuration for this system is equal with my previous article, the differences are on the corosync config and the way to start pacemaker and drbdlinks. In the corosync version newer than 2.x, pacemaker is no longer started by corosync, so pacemaker should be loaded automatically during start up. Below is the example configuration of the corosnyc.conf:

Saturday, February 15, 2014

Tvheadend on cubieboard1 with Terratec Cinergy HTC stick HD (0ccd:00b2)

The USB stick doesn't automatically recognized by the Cubieboard1 linux sdcard image. You must compile the kernel and enable em28xx config as module. Here is the example of working config file for this stick and compiled kernel and module.
1. config.
2. uImage.
3. kernel-module.
To install above kernel or if you want to compile the kernel yourself, please follow this instruction from this website. We also need a firmware for the stick, download dvb-usb-terratec-htc-stick-drxk.fw from here and put in /lib/firmware directory.

Monday, November 25, 2013

Apache2 LDAPS Auth config against eDirectory

Apache2 LDAPS Auth Config against eDirectory

  1. Create cert directory in apache conf directory:
    mkdir /etc/apache2/cert
  2. Download LDAP cert from eDirectory server and copy to /etc/apache2/cert:
    cp CA.b64 /etc/apache2/cert/
  3. Create config file /etc/apache2/conf.d/ldaps and add this line:
    LDAPTrustedGlobalCert CA_BASE64 "/etc/apache2/cert/CA.b64"
  4. Edit ssl config file /etc/apache2/sites-enabled/default-ssl and add these lines to protect the directory:
    Alias /phpmyadmin /usr/share/phpmyadmin/
    <Directory "/usr/share/phpmyadmin">
     AuthName "Access to phpMyAdmin: Login using LDAP user"
     AuthType basic
     AuthBasicProvider ldap
     AuthLDAPUrl ldaps://,o=company?cn
     Require ldap-user username1 username2
  5. Restart apache2:
    service apache2 restart

References :