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