All the administration procedures are executed by launching ant tasks declared in the ant file build.xml, for instance:

ant update-index

Administration scripts are however needed to call asynchrnous tasks:

Main administration tasks

Initializing the database

ant init-data

Upgrading the database

ant upgrade

Starting|stopping|restarting the application

ant start|stop|restart

Updating the index

ant update-index

Rebuilding the index

ant rebuild-index

Unlocking the index

ant unlock-index

Archiving closed tickets

ant archive-tickets

Expiring non approved tickets

ant expire-tickets

Recalling postponed tickets

ant recall-tickets

Sending daily ticket reports

ant send-ticket-reports

Sending FAQ updates reports

ant send-faq-reports

Feeding the helpdesk

ant feed

Starting/stopping esup-helpdesk when the application is deployed as a portlet should not be done with the start/stop tasks. In this case, start/stop your portal, or better just the esup-helpdesk context.

Setting up administration scripts

This part shows how to set up administration scripts and launch asynchronous tasks for a quick-start deployment. These procedures must adapted for the other deployment modes (portlet et servlet).

On a Unix system

We presume here that the project base is /usr/local/helpdesk.

[root@server helpdesk]# ls -al
total 96
-rwxr-xr-x  1 root root    78 2008-06-16 12:37 env.sh             (current version)
drwxr-xr-x  2 root root 69632 2008-05-21 12:22 files              (attached files)
-rwxr-xr-x  1 root root   567 2008-03-28 10:16 helpdesk-cron.sh   (asynchrnous tasks script)
-rwxr-xr-x  1 root root   292 2008-03-28 10:16 helpdesk.sh        (synchrnous tasks script)
drwxr-xr-x  2 root root  4096 2008-06-18 11:50 index              (index data)
drwxr-xr-x  2 root root  4096 2008-06-17 06:08 log                (logs)
drwxr-xr-x 19 root root  4096 2008-06-16 12:38 src                (distribution files)

Administration scripts

The file env.sh contains the current version:

#/bin/bash
. /etc/profile.d/java.sh
export ESUP_HELPDESK_VERSION=3.12.3

The script helpdesk.sh is used to run synchrnous tasks (start, stop, deploy, ...):

#!/bin/bash
. /usr/local/helpdesk/env.sh
echo Esup-Portail Helpdesk $ESUP_HELPDESK_VERSION, running ant task $1
pushd /usr/local/helpdesk/src/esup-helpdesk-quick-start-$ESUP_HELPDESK_VERSION > /dev/null
# to prevent from Sun AWT bug when generating charts
unset DISPLAY
ant $1
popd > /dev/null

The script helpdesk can be installed in the folder /etc/init.d for the application to automatically start when the server boots:

#!/bin/bash
#
# helpdesk     Startup script for ESUP-Portail helpdesk
#
# chkconfig: - 99 01
# description: esup-helpdesk is the helpdesk application \
#               provided by consortium ESUP-Portail.

# Source function library.
. /etc/rc.d/init.d/functions

prog=/usr/local/helpdesk/helpdesk.sh

start() {
        echo -n $"Starting $prog: "
        $prog start &
}
stop() {
        echo -n $"Stopping $prog: "
        $prog stop
}
status() {
        echo `ps aux | grep java | grep -v grep | wc -l` Java processes found.
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status
        ;;
  restart)
        stop
        start
        ;;
  *)
        echo $"Usage: $prog {start|stop|restart|status}"
        exit 1
esac

Le redémarrage de l'application pourra ainsi se faire en appelant :

/etc/init.d/helpdesk restart

Pour faire en sorte que l'application démarre automatiquement au boot du serveur, utiliser le programme chkconfig.

Asynchronous tasks

Calling asynchronous tasks is needed for:

The script helpdesk-cron.sh is used to call asynchronous tasks (update-index, archive-tickets, recall-tickets, ...):

#!/bin/bash
. /usr/local/helpdesk/env.sh
[ -z "$1" ] && { exit 1; }
export LOG_FILE=/usr/local/helpdesk/log/$1.log
echo ----------------------------------------------- >> $LOG_FILE
date >> $LOG_FILE
echo Esup-Portail Helpdesk $ESUP_HELPDESK_VERSION, running ant task $1 >> $LOG_FILE
pushd /usr/local/helpdesk/src/esup-helpdesk-quick-start-$ESUP_HELPDESK_VERSION > /dev/null
ant $1 >> $LOG_FILE
popd > /dev/null

Asynchrnous tasks are called periodically thanks to the following lines in the file /etc/crontab:

00,05,10,15,20,25,30,35,40,45,50,55 * * * * root /usr/local/helpdesk/helpdesk-cron.sh update-index
01 * * * * root /usr/local/helpdesk/helpdesk-cron.sh expire-tickets
03 * * * * root /usr/local/helpdesk/helpdesk-cron.sh archive-tickets
05 * * * * root /usr/local/helpdesk/helpdesk-cron.sh send-ticket-reports
00 0 * * * root /usr/local/helpdesk/helpdesk-cron.sh send-faq-reports
01 0 * * * root /usr/local/helpdesk/helpdesk-cron.sh recall-tickets

On a Windows system