2008-02-04 13:40:01 +00:00
|
|
|
args: with args;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.ejabberd;
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
2008-07-06 11:30:53 +01:00
|
|
|
name = "ejabberd";
|
2008-07-23 15:13:27 +01:00
|
|
|
|
2008-07-06 11:30:53 +01:00
|
|
|
job = ''
|
|
|
|
description "EJabberd server"
|
2008-02-04 13:40:01 +00:00
|
|
|
|
2008-07-06 11:30:53 +01:00
|
|
|
start on network-interface/started
|
|
|
|
stop on network-interfaces/stop
|
|
|
|
|
|
|
|
start script
|
2008-07-23 15:13:27 +01:00
|
|
|
# Initialise state data
|
|
|
|
mkdir -p ${cfg.logsDir}
|
|
|
|
|
|
|
|
if ! test -d ${cfg.spoolDir}
|
|
|
|
then
|
|
|
|
cp -av ${pkgs.ejabberd}/var/lib/ejabberd /var/lib
|
|
|
|
fi
|
2008-08-18 15:48:55 +01:00
|
|
|
|
|
|
|
mkdir -p ${cfg.confDir}
|
|
|
|
sed -e 's|{hosts, \["localhost"\]}.|{hosts, \[${cfg.virtualHosts}\]}.|' ${pkgs.ejabberd}/etc/ejabberd/ejabberd.cfg > ${cfg.confDir}/ejabberd.cfg
|
2008-07-06 11:30:53 +01:00
|
|
|
end script
|
|
|
|
|
2008-08-18 15:48:55 +01:00
|
|
|
respawn ${pkgs.bash}/bin/sh -c 'export PATH=$PATH:${pkgs.ejabberd}/sbin; cd ~; ejabberdctl --logs ${cfg.logsDir} --spool ${cfg.spoolDir} --config ${cfg.confDir}/ejabberd.cfg start; sleep 1d'
|
2008-07-06 11:30:53 +01:00
|
|
|
|
|
|
|
stop script
|
|
|
|
${pkgs.ejabberd}/sbin/ejabberdctl stop
|
|
|
|
end script
|
|
|
|
'';
|
2008-02-04 13:40:01 +00:00
|
|
|
}
|