682f57
#!/bin/sh
682f57
# get_config [config default]
682f57
# extracts config option from config file
682f57
get_config() {
682f57
  if conf=$(grep "^$1" /etc/imapd.conf); then
682f57
    echo $conf | cut -d: -f2
682f57
  else
682f57
    echo $2
682f57
  fi
682f57
}
682f57
682f57
CONFIGDIRECTORY=$(get_config configdirectory /var/lib/imap)
682f57
RETVAL=0
682f57
682f57
start() {
682f57
      cd $CONFIGDIRECTORY
682f57
      runuser - cyrus -s /bin/sh -c "umask 166 ; /usr/lib/cyrus-imapd/cvt_cyrusdb_all > ${CONFIGDIRECTORY}/rpm/db_import.log 2>&1" < /dev/null
682f57
      RETVAL=$?
682f57
}
682f57
682f57
stop() {
682f57
      cd $CONFIGDIRECTORY
682f57
      runuser - cyrus -s /bin/sh -c "umask 166 ; /usr/lib/cyrus-imapd/cvt_cyrusdb_all export > ${CONFIGDIRECTORY}/rpm/db_export.log 2>&1" < /dev/null
682f57
      RETVAL=$?
682f57
}
682f57
682f57
case "$1" in
682f57
  start)
682f57
    start
682f57
    ;;
682f57
  stop)
682f57
    stop
682f57
    ;;
682f57
  *)
682f57
    ;;
682f57
esac
682f57
682f57
exit $RETVAL