Remove roundcube sessions on boot and shutdown

This commit is contained in:
Daniel Frank 2019-06-17 23:01:31 +02:00
parent 76bbffb4da
commit a39c6f7c27
Signed by: tokudan
GPG key ID: 063CCCAD04182D32

View file

@ -96,6 +96,18 @@ in
chown -c "${config.variables.roundcubeUser}":root "${config.variables.roundcubeDataDir}/des_key"
chmod -c 400 "${config.variables.roundcubeDataDir}/des_key"
fi
if [ -s "${config.variables.roundcubeDataDir}/roundcube.sqlite" ]; then
# Just go ahead and remove the sessions on a boot
${pkgs.sqlite}/bin/sqlite "${config.variables.roundcubeDataDir}/roundcube.sqlite" "DELETE FROM session;"
fi
'';
serviceConfig.ExecStop = pkgs.writeScript "roundcube-delete-sessions" ''
#!${pkgs.stdenv.shell}
set -euo pipefail
if [ -s "${config.variables.roundcubeDataDir}/roundcube.sqlite" ]; then
# Just go ahead and remove the sessions on shutdown.
${pkgs.sqlite}/bin/sqlite "${config.variables.roundcubeDataDir}/roundcube.sqlite" "DELETE FROM session;"
fi
'';
};
services.phpfpm.pools."${poolName}" = {