kopano-gateway.init.suse 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #! /bin/sh
  2. #
  3. ### BEGIN INIT INFO
  4. # Provides: kopano-gateway
  5. # Required-Start: $syslog $network $remote_fs
  6. # Required-Stop: $syslog $network $remote_fs
  7. # Should-Start: kopano-server
  8. # Should-Stop: kopano-server
  9. # Default-Start: 2 3 5
  10. # Default-Stop: 0 1 6
  11. # X-UnitedLinux-Default-Enabled: yes
  12. # Short-Description: Kopano Core POP3/IMAP Gateway
  13. ### END INIT INFO
  14. . /etc/rc.status
  15. rc_reset
  16. GATEWAYCONFIG=/etc/kopano/gateway.cfg
  17. GATEWAYPROGRAM=/usr/sbin/kopano-gateway
  18. # Sanity checks.
  19. #[ -f $GATEWAYCONFIG ] || exit 0
  20. [ -x $GATEWAYPROGRAM ] || exit 0
  21. GATEWAYCONFIG_OPT=""
  22. [ ! -z $GATEWAYCONFIG -a -f $GATEWAYCONFIG ] && GATEWAYCONFIG_OPT="-c $GATEWAYCONFIG"
  23. [ -f /etc/sysconfig/kopano ] && . /etc/sysconfig/kopano
  24. if [ -z "$KOPANO_LOCALE" ]; then
  25. KOPANO_LOCALE="C"
  26. fi
  27. gateway=`basename $GATEWAYPROGRAM`
  28. case "$1" in
  29. start)
  30. echo -n "Starting gateway "
  31. install -dm0775 -o kopano -g kopano /var/run/kopano
  32. export LC_ALL=$KOPANO_LOCALE
  33. export LANG=$KOPANO_LOCALE
  34. $GATEWAYPROGRAM $GATEWAYCONFIG_OPT
  35. rc_status -v
  36. unset LANG LC_ALL
  37. ;;
  38. stop)
  39. echo -n "Stopping gateway "
  40. killproc $gateway
  41. rc_status -v
  42. ;;
  43. restart)
  44. $0 stop
  45. $0 start
  46. ;;
  47. reload)
  48. echo -n "Restarting gateway: "
  49. killproc $GATEWAYPROGRAM -SIGHUP
  50. rc_status -v
  51. ;;
  52. status)
  53. echo -n "Checking for gateway "
  54. checkproc $gateway
  55. rc_status -v
  56. ;;
  57. *)
  58. ;;
  59. esac
  60. rc_exit