Autorun ManageEngine Servidesk in Linux

This guide for CentOS. With small edit you can use in another linux distributive.

Create /etc/init.d/servicedesk and insert code below (change MDIR)

#!/bin/bash
#
# Startup script for the pmagent
#

# chkconfig: 345 99 02
# description: Run the SupportCenter-Plus program

INITLOG_ARGS=""
 
prog="servicedesk"
progname="ManageEngine ServiceDesk"
RETVAL=0
# Edit the following to indicate the 'bin' directory for your installation
MDIR=/change/me/bin
 
if [ ! -d "$MDIR" ]
then
 echo "Invalid directory $MDIR"
    exit 1
fi
 
start()
{
        mv -f /var/log/servicedesk.log /var/log/servicedesk1.log
	echo "Starting $progname"
        cd $MDIR
	nohup sh run.sh >/var/log/servicedesk.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.log 2>&1  
}
 
case "$1" in
 start)
       start
         ;;
 stop)
      stop
        ;;
    *)
     echo "Usage: $prog {start|stop}"
     exit 1
     ;;
esac
 
exit $RETVAL

After

chmod 755 /etc/init.d/servicedesk
touch /var/log/servicedesk.log

Adding in autorun

chkconfig --add servicedesk

After that you can use command line

service servicedesk start|stop

Добавить комментарий

Этот сайт использует Akismet для борьбы со спамом. Узнайте, как обрабатываются ваши данные комментариев.