1.Tạo 1 file script trong thư mục /etc/init.d/ bằng lệnh sau:

vi /etc/init.d/[tên file script]

Ví dụ muốn tạo file tên là service, gõ lệnh sau:
vi /etc/init.d/service

Thêm nội dung sau đây vào file vừa tạo:
#! /bin/bash
#
# chkconfig: 35 95 5
# description: Startup/Shutdown script
WORK_DIR=/app/ftl/wak
cd $WORK_DIR
pid_file=thread.pid
APP_NAME='FTLService'

RUNNING=0

if [ -f $pid_file ]; then
    pid=`cat $pid_file`
    if [ "x$pid" != "x" ] && kill -0 $pid 2>/dev/null; then
        RUNNING=1
    fi
fi

start()
{
    if [ $RUNNING -eq 1 ]; then
        echo $APP_NAME" already started"
    else
        ./run.sh &
        echo $! > $pid_file
        echo $APP_NAME" started"
    fi
}

stop()
{
    if [ $RUNNING -eq 1 ]; then
        pkill -TERM -P $pid
        kill -9 $pid
        RUNNING=0
        echo $APP_NAME" stopped"
    else
        echo $APP_NAME" not running"
    fi
}

restart()
{
    stop
    start
}

case "$1" in

    'start')
        start
        ;;

    'stop')
        stop
        ;;

    'restart')
        restart
        ;;

    *)
        echo "Usage: $0 {  start | stop | restart  }"
        exit 1
        ;;
esac
exit 0

Trong đó chú ý WORK_DIR là đường dẫn tới dịch vụ đang cần autostart. Như nội dung trên thì dịch vụ cần autostart nằm ở đường dẫn /app/ftl/wak.
2.Enable chức năng autostart bằng các lệnh sau:
chkconfig --add [tên file script]

chkconfig --level 345 [tên file script] on

Trong đó tên file script là tên file script ở trên. Ví dụ tên file là service thì gõ các lệnh sau:
chkconfig --add service
chkconfig --level 345 service on

3.Phân quyền cho file script bằng lệnh:
chmod +x /etc/init.d/[tên file script]

4.Kiểm tra:
Tắt dịch vụ sau đó chạy câu lệnh:
service [tên file script] start

Nếu dịch vụ được bật lên thì quá trình cài đặt thành công
Hoặc:
Reboot lại server bằng lệnh:
reboot

Sau đó kiểm tra xem dịch vụ có autostart hay không.
Finish!!!