From a39c6f7c278fae97bc7a23829ba7b07c23fa7cef Mon Sep 17 00:00:00 2001 From: Daniel Frank Date: Mon, 17 Jun 2019 23:01:31 +0200 Subject: [PATCH] Remove roundcube sessions on boot and shutdown --- roundcube.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/roundcube.nix b/roundcube.nix index ba55324..a108277 100644 --- a/roundcube.nix +++ b/roundcube.nix @@ -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}" = {