23 October 2007

[skrip]Auto Start ServiceDesk

Berhubung ServiceDesk merupakan aplikasi dari pihak ketiga tidak langsung menyediakan auto start di Linux. CentOS merupakan Linux yang saya gunakan, maklum tuntutan perusahaan :).
Langkah membuat auto start di CentOS :
1. Pastikan bahwa ServiceDesk sudah terinstal dalam hal ini terinstall di /opt/AdventNet/ME/ServiceDesk.
2. Membuat file servicedesk.sh
touch /etc/init.d/servicedesk.sh

3. Kopikan skrip dibawah ini kedalam file servicedesk.sh.
#!/bin/bash
#
# Startup script for the pmagent
#
# chkconfig: 345 99 02
# description: Run the ServiceDesk-Plus program
INITLOG_ARGS=""
prog="servicedesk.sh"
progname="AdventNet ManageEngine ServiceDesk-Plus"
RETVAL=0
# Edit the following to indicate the 'bin' directory for your installation
MDIR=/opt/AdventNet/ME/ServiceDesk/bin
if [ ! -d "$MDIR" ]
then
echo "Invalid directory $MDIR"
exit 1
fi
start()
{
mv -f /var/log/servicedesk-plus.log /var/log/servicedesk-plus1.log
echo "Starting $progname"
cd $MDIR
nohup sh run.sh >/var/log/servicedesk-plus.log 2>&1 &
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/servicedesk
}
stop()
{
echo "Stopping $progname"
cd $MDIR
sh shutdown.sh -S >>/var/log/servicedesk-plus.log 2>&1
}
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo "Usage: $prog {start|stop}"
exit 1
;;
esac
exit $RETVAL

4. Ganti hak akses file servicedesk.sh.
chmod 755 /etc/init.d/servicedesk.sh

5.Membuat file log ServiceDesk.
touch /var/log/servicedesk-plus.log

6. Tambahkan auto start pada chkconfig.
chkconfig --add servicedesk.sh

7. Silahkan reboot untuk membuktikan bahwa benar-benar auto start saat booting.

Mungkin untuk Ubuntu tinggal ketik "sudo update-rc.d servicedesk.sh defaults" pada point 6, karena saya belum membuktikan di Ubuntu :p.

Sumber : http://forums.adventnet.com/viewtopic.php?p=6030

3 comments:

  1. skrip AppManager :
    #!/bin/bash
    #
    # Startup script for the pmagent
    #
    # chkconfig: 345 99 02
    # description: Run the ServiceDesk-Plus program

    INITLOG_ARGS=""
    prog="appmanager.sh"
    progname="AdventNet ManageEngine AppManager"
    RETVAL=0

    # Edit the following to indicate the 'bin' directory for your installation
    MDIR=/opt/AdventNet/ME/AppManager8/

    if [ ! -d "$MDIR" ]
    then
    echo "Invalid directory $MDIR"
    exit 1
    fi

    start()
    {
    mv -f /var/log/appmanager.log /var/log/appmanager1.log
    echo "Starting $progname"
    cd $MDIR
    nohup sh startApplicationsManager.sh >/var/log/appmanager.log 2>&1 &
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && touch /var/lock/subsys/appmanager
    }

    stop()
    {
    echo "Stopping $progname"
    cd $MDIR
    sh shutdownApplicationsManager.sh >>/var/log/appmanager.log 2>&1
    }


    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    *)
    echo "Usage: $prog {start|stop}"
    exit 1
    ;;
    esac

    exit $RETVAL

    ReplyDelete
  2. skrip NetFlow :
    #!/bin/bash
    #
    # Startup script for the pmagent
    #
    # chkconfig: 345 99 02
    # description: Run the ServiceDesk-Plus program

    INITLOG_ARGS=""
    prog="netflow.sh"
    progname="AdventNet ManageEngine NetFlow"
    RETVAL=0

    # Edit the following to indicate the 'bin' directory for your installation
    MDIR=/opt/AdventNet/ME/NetFlow/bin/

    if [ ! -d "$MDIR" ]
    then
    echo "Invalid directory $MDIR"
    exit 1
    fi

    start()
    {
    mv -f /var/log/netflow.log /var/log/netflow1.log
    echo "Starting $progname"
    cd $MDIR
    nohup sh run.sh >/var/log/netflow.log 2>&1 &
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && touch /var/lock/subsys/netflow
    }

    stop()
    {
    echo "Stopping $progname"
    cd $MDIR
    sh shutdown.sh >>/var/log/netflow.log 2>&1
    }


    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    *)
    echo "Usage: $prog {start|stop}"
    exit 1
    ;;
    esac

    exit $RETVAL

    ReplyDelete
  3. Skrip OpManager :
    #!/bin/bash
    #
    # Startup script for the pmagent
    #
    # chkconfig: 345 99 02
    # description: Run the ServiceDesk-Plus program

    INITLOG_ARGS=""
    prog="opmanager.sh"
    progname="AdventNet ManageEngine OpManager"
    RETVAL=0

    # Edit the following to indicate the 'bin' directory for your installation
    MDIR=/opt/AdventNet/ME/OpManager/bin

    if [ ! -d "$MDIR" ]
    then
    echo "Invalid directory $MDIR"
    exit 1
    fi

    start()
    {
    mv -f /var/log/opmanager.log /var/log/opmanager1.log
    echo "Starting $progname"
    cd $MDIR
    nohup sh StartOpManagerServer.sh > /var/log/opmanager.log 2>&1 &
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && touch /var/lock/subsys/opmanager
    }

    stop()
    {
    echo "Stopping $progname"
    cd $MDIR
    sh ShutDownOpManager.sh >>/var/log/opmanager.log 2>&1
    }


    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    *)
    echo "Usage: $prog {start|stop}"
    exit 1
    ;;
    esac

    exit $RETVAL

    ReplyDelete

Disqus for Dedy selalu Milisdad