Blame SOURCES/cyr_systemd_helper

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