Try harder to disable monit.
[carnet-upgrade.git] / src / functions.sh
index 33ac260..b595580 100644 (file)
@@ -373,7 +373,7 @@ add_group_proc () {
 
 # backup ldap database
 backup_slapd_db () {
-  local ldap_backup=/var/backups/slapcat.$backup_ext
+  local ldap_backup=/var/backups/slapcat.$backup_ext.gz
   local old_umask result
 
   if [ ! -f $ldap_backup ]; then
@@ -383,7 +383,7 @@ backup_slapd_db () {
       /etc/init.d/slapd stop || true
       old_umask=`umask`
       umask 0077 # protect the backup file
-      slapcat -l $ldap_backup
+      slapcat | gzip --best > $ldap_backup
       result=$?
       umask $old_umask
       /etc/init.d/slapd start || true
@@ -591,6 +591,22 @@ remove_skey () {
   fi
 }
 
+# monit it causing problems for postinst scripts
+# restarting daemons so try to disable it
+disable_monit () {
+  if pkg monit-cn; then
+    pkgrm monit-cn # disables monit in prerm
+  fi
+
+  # if configured manually
+  if pkg monit; then
+    # remove the binary but leave the config
+    apt-get remove --yes monit
+    # stop the binary
+    pkill -9 monit || true
+  fi
+}
+
 # make a silent upgrade to new libc6
 upgrade_libc () {
   DEBIAN_FRONTEND=noninteractive pkgadd libc6