Skip to content

Managing Services

hamar edited this page Nov 17, 2011 · 1 revision

11. Managing the services

11.1 Adding startup script

In order to make the DIRAC components running we use the runit mechanism (http://smarden.org/runit/). For each component that must run permanently (services and agents) there is a directory created under /opt/dirac/startup that is monitored by a runsvdir daemon. The installation procedures above will properly start this daemon. In order to ensure starting the DIRAC components at boot you need to add a hook in your boot sequence.

A possible solution is to add an entry in the /etc/inittab::

SV:123456:respawn:/opt/dirac/sbin/runsvdir-start

Together with a script like (it assumes that in your server DIRAC is using dirac local user to run)::

#!/bin/bash
source /opt/dirac/bashrc
RUNSVCTRL=`which runsvctrl`
chpst -u dirac $RUNSVCTRL d /opt/dirac/startup/*
killall runsv svlogd
killall runsvctrl
/opt/dirac/pro/mysql/share/mysql/mysql.server stop  --user=dirac
sleep 10
/opt/dirac/pro/mysql/share/mysql/mysql.server start --user=dirac
sleep 20
RUNSVDIR=`which runsvdir`
exec chpst -u dirac $RUNSVDIR -P /opt/dirac/startup 'log:  DIRAC runsv'

The same script can be used to restart all DIRAC components running on the machine.

11.2 Service status

Clone this wiki locally