Monthly Archives: June 2014

Script Linux/Unix : Monitoring Service

Selamat Malam bro, cie cie yang bentar lagi liburan semester hehe

Malem ini mau sharing Tips&Trik nih, barusan nemu artikel bagus. Jadi langgung di abadikan aja di blog biar gak lupa. Tips untuk mengetahui apakah Service yang kita jalanin sewaktu2 mati, atau ada yang usil gitukan jadi langgsung ke log dan di kirim ke email kita. #siapsiaga :)

Lebih berguna mungkin untuk para sysadmin yang harus standby gitukan :p langgsung saja SC nya dibawah ini :

# Name : service.chk 
# URL:
# Purpose: A simple process checker. Find out if service is running or not.
# Tested on: Debian and RHEL based system only.
# ----------------------------------------------------------------------------
# Author: nixCraft <>
# Copyright: 2009 nixCraft under GNU GPL v2.0+
# ----------------------------------------------------------------------------
# Last updated: 13/Mar/2013 - Added support for email and other enhancements 
# Last updated: 05/Dec/2011 - Added support for binary path check
# ----------------------------------------------------------------------------
## Change as per your distro 
## Add binary list here
_chklist="/usr/bin/php-cgi /usr/sbin/nginx /usr/sbin/lighttpd /usr/sbin/mysqld /usr/sbin/apache2 /usr/sbin/named /usr/sbin/pgsqld"
## yes | no
## Add your email id
## Do not change below
_running() {
	local p="${1##*/}"
	local s="true"
	$_pgrep "${p}" >/dev/null || { s="false"; _failed="true"; _service="${_service} $1,"; }
	[[ "$s" == "true" ]] && echo "$1 running" || { echo -n "$1 not running"; [[ ! -f "$1" ]] && echo " [ $1 not found ]" || echo ; }
## header
echo "Service status on ${HOSTNAME} @ $(date)"
echo "------------------------------------------------------"
## Check if your service is running or not 
for s in $_chklist
	_running "$s"
## Send a quick email update (good for cron jobs) ##
[[ "$_failed" == "true" && "$_sendemail" == "yes" ]] && { _mess="$_service failed on $HOSTNAME @ $(date)"; 
                                 		     $_mail -s 'Service not found' "$_email" < "${_mess}";


Saya sudah coba testing, dan work kok.

Semoga Bermanfaat bro :)



Linux : Tutorial install ftp menggunakan pure-ftpd on centos 6

Selamat Malam bro, duh udah lama sekali gak update-update huhuhu, maklum bro bulan ini adalah bulan dimana masa-masa UAS untuk mahasiswa dan efek samping nya harus mengumpulkan project final. loh kok jadi curhat kwkwkw


Dipertemuan kali ini saya akan membahas tentang FTP, dan cara instalasi di server OS Centos6, Mungkin saya akan menggambarkan apa sih itu ftp server.

FTP adalah Protokol yang bekerja pada dasar pentransfean berkas/file, FTP bekerja pada koneksi TCP maupun UDP. Saat ini FTP server banyak dimanfaatkan oleh jasa penyedia hosting website untuk upload kode – kode website ke Server penyedia jasa hosting, tapi sebenarnya jika dimanfaatkan dengan tepat FTP banyak sekali gunanya. FTP merupakan Protokol yang pertama kali di kembangkan di university of California, Berkeley di jalankan pada 4.2BSD sebagai pengenalan system BSDUnix pada saat itu.



FTP dibagi menjadi 2 hal yaitu FTP Server dan FTP Client :



Apa itu FTP Server? adalah suatu server yang menjalankan aplikasi FTP yang selalu siap memberikan permintaan bila mendapatkan Request dari FTP Client.

Apa itu FTP Client? adalah komputer yang melakukan permintaan koneksi ke server untuk upload maupun download satu atau banyak file.



FTP Client saat ini dapat kalian download berupa software seperti FileZilla, WinSCP dll, untuk lebih jelas bro bisa tanya2 google hehe




OK mari kita sedikit belajar membuat FTP Server serderhanya untuk keperluan pribadi.

Bawaan dari CentOS PureFTPD tidak disupport oleh karena itu kita akan ambil repository dari pihak ke 3, langgsung saja check out tutorial nya bro.



Tutorial install ftp menggunakan pure-ftpd on centos 6Finc on Vimeo.


Semoga Bermanfaat bro :)

Installing USBasp Drivers on Windows 8.1

When we are dealing with AVR programming, after create the codes in our development machine we should write the code into the device. For this purpose, we need a tool which we called Downloader or Programmer. This tool will “burn” the code into AVR CPU using spesific port.

One popular tool is USBasp ( This tool is a USB in-circuit programmer which consists of an ATMega88 or an AtMega8 and a couple of passive components. In short, we need no special USB controller anymore.


Sometimes, we might face a problem installing usbasp drivers on Windows 8.1. But, this article will discuss about how to install those drivers.


The method described here will require machine to restart. Make sure you have write down the steps before proceeding.

Identify The Problem

he main problem is that Microsoft doesn’t allow us to install drivers which are not ‘digitally signed’ directly (or easily) on Windows Vista and later version (7, 8, and also 8.1). To get around this, we must temporarily disable the signature verification process.

Phase 1: Disable Driver Signature Enforcement

  1. Enter “start screen” and open “PC Settings”
  2. Choose “Update and recovery” option in the left panel.
  3. Choose “Recovery” option in the left panel
  4. Click on “Restart now” button, below the “Advanced startup” section then click “reset” button to begin resetting.
  5. Once machine is restarted, we will face several options which we can choose by pressing F1-F9. Choose F7 for “Disable driver signature enforcement”

Now, the machine will boot with no driver signature enforcement. We can then install the driver to our machine.

Phase 2: USBasp Driver Installation

Download the driver fro Windows from USBasp ( The latest version is version which can be downloaded here. Read the readme first. Because I use WinAVR version 20100110, i will extract the libusb_0.1.12.1 folder as D:\libusb_0.1.12.1.

Plug the USBasp in to USB port. Windows will try to recognize the device. It should be recognized but it lacks of driver so the process is not finish.

Open “Device Manager” on “Control Panel”. Look for Other devices. We have USBasp device there.


Right click on it and click on “Update Driver Software…”


Click on “Browse my computer for driver software”.


Type the location of folder “D:\libusb_0.1.12.1″ and then click “Next”.


Windows will give warning as it can’t verify the publisher of the driver. Just ignore it and select “Install this driver software anyway”


Let the installation proceed and wait until it finish.



AVR Microcontroller Programming in Windows

AVR or Alf & Vegard RISC, is a single chip microcontroller developed by Atmel. AVR is a modified Harvard architecture 8-bit RISC (Reduced Instruction Set Computer) which is famous microcontroller.

AVR microcontrollers has many categories or we will say family. Family basically a group or category based on similiar characteristic and properties. There are six family and fortunately, AVR microcontrollers have same architecture so programming in any kind of family can be guaranteed work on other family. It is only limited to physical limitation such as different amount of flash storage, etc. This is also an advantage using AVR while variety options can be found while developing microcontroller project.

This article will be covering preparation and setting up environment in Linux to develop AVR program.

What you will need:

  1. Microsoft Windows Operating System
  2. avrdude
  3. avr-gcc
  4. avr-binutils
  5. A programmer (will be described later)
  6. AVR Microcontroller, with it’s development board if any, in this case I use AVR ATMega32

Program in Microcontroller

Before I start, let’s talk about program. What is program? A program is simply set of instructions written using machine language so it can be executed by machine. It is also called “binary” which mean to be not human-readable file (but can be understood by machine). For microcontrollers, binary files have type .hex (Intel Hex Format). You can imagine it as .exe in windows application. There are other forms, but in this article we will focus on .hex.

AVR has a small amount of memory in it. It is a storage where program is actually saved. And yes it is small compared by computer. Just some Kilobytes. When the chip starts up, microcontroller will start running whatever program written in flash.

Compiler and Cross Compiling

Compilation for microcontroller is basically similar to compiling program for PC. However, the difference between those two is in term of product of compilation. Compiler for AVR is run in our PC (developer machine), compile source code, and then produce machine language which is specific for the microcontroller (not our PC). This process is called cross compiling.

There are many cross compiler for AVR. I use AVR-GCC for this purpose (in this article and other similar articles, unless told otherwise).

Other tools we need are collectively known as avr-binutils. The binutils packages provide all the low-level utilities needed in building and manipulating object files. In this package, we have AVR assembler (avr-as), linker (avr-ld), and librarian (avr-ar and avr-ranlib). In addition, we get tools which extract data from object files (avr-objcopy), dissassemble object file information (avr-objdump), and strip information from object files (avr-strip).

The last thing to mention is the libc or standard c library. This is library designed for AVR microcontroller, or in other word it is different with our library used for PC programing.

Fortunately, avr-gcc, avr-binutils, avr-libc, and avrdude (later) are already ported into Windows. These Windows version tools are collectively called WinAVR. We can download WinAVR for free from sourceforge site ( Download the latest version.

Download / Burn the Program to the Chip

To program microcontroller we need a downloader. It is a special chip that can connect your microcontroller with our computer and write our program into our chip. Every AVR has a set of pins that are programming pins. You have to verify you chip pins and connect the programmer to those pins in the right order.

So what programmer can be used? In this article I used USBasp. Of course you can have other programmers, but I will only talk about this programmer. For information about USBasp, you can visit this link

Now we have know our programmer (USBasp I mean) but then, how to write our program to microcontroller? Relax! We will cover now.

We will use avrdude, a small application to do that. This tool is already included in WinAVR.

Let’s take a peek of avrdude by give this command on our terminal:


Let’s see what we have got. You will get something like this:

Usage: avrdude [options]
-p <partno>                Required. Specify AVR device.
-b <baudrate>              Override RS-232 baud rate.
-B <bitclock>              Specify JTAG/STK500v2 bit clock period (us).
-C <config-file>           Specify location of configuration file.
<strong>-c <programmer>            Specify programmer type.</strong>
-D                         Disable auto erase for flash memory
-i <delay>                 ISP Clock Delay [in microseconds]
-P <port>                  Specify connection port.
-F                         Override invalid signature check.
-e                         Perform a chip erase.
-O                         Perform RC oscillator calibration (see AVR053).
-U <memtype>:r|w|v:<filename>[:format]
 Memory operation specification.
 Multiple -U options are allowed, each request
 is performed in the order specified.
-n                         Do not write anything to the device.
-V                         Do not verify.
-u                         Disable safemode, default when running from a script.
-s                         Silent safemode operation, will not ask you if
fuses should be changed back.
-t                         Enter terminal mode.
-E <exitspec>[,<exitspec>] List programmer exit specifications.
-x <extended_param>        Pass <extended_param> to programmer.
-y                         Count # erase cycles in EEPROM.
-Y <number>                Initialize erase cycle # in EEPROM.
-v                         Verbose output. -v -v for more.
-q                         Quell progress output. -q -q for less.
-?                         Display this usage.

avrdude version 5.10, URL: <>

Woah, that’s too much. But our interest is only in few options. I’ve bold the text which will get our attention. We only interests in -p, -U, and -c options as this is a minimum command we need to invoke along with avrdude.

  • -c : We specify the programmer we type. We are using usbasp so can be replaced with usbasp. Of course if you are using other programmer you must specify. For a complete list about supported programmer, invoke command: avrdude -c asdf. Because asdf is not a valid programmer, avrdude would complaint and print out list of supported programmer to you. Read it and verify your programmer is supported.
  • -U :r|w|v:[:format]: This is the most important command. is either flash or eeprom which is destination where our program will be stored. Next is r (read), w (write), or v (verify) option that you must choose one (only one). Next is which you have to replace with your program path and name. Next is optional format flag [:format] that specify our program format.
  • -p : Specify microcontroller series. Or simply what microcontroller we willl program. For example I will use ATMega32 so i will replace with atmega32.

With these three, we can program in minimal. In this case when I want to program ATMega32 using USBasp with filename avr_leds.hex, the command I use will be:

avrdude -c usbasp -U flash:w:avr_leds.hex -p atmega32

Wait until process is finish and then you can see you microcontroller is programmed now.

Next time I will write some actual writing program for AVR.