Advertisement
rfmonk

sample_postfix_init_script.sh

Apr 12th, 2014
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.79 KB | None | 0 0
  1. #!/sbin/sh
  2. #
  3. # Set the path to your own logger & postfix commands
  4. # Sample SysV-style
  5. #
  6. LOGGER="/usr/bin/logger"
  7. POSTFIX="/usr/sbin/postfix"
  8. rc=0
  9.  
  10. if [ ! -f $POSTFIX ] ; then
  11.     $LOGGER -t $0 -s -p mail.err "Unable to locate Postfix"
  12.     exit(1)
  13. fi
  14. if [ ! -f /etc.postfix/main.cf ] ; then
  15.     $LOGGER -t $0 -s -p mail.err "Unable to locate Postfix configuration"
  16.     exit(1)
  17. fi
  18.  
  19. case "$1" in
  20.     start)
  21.         echo -n "Starting Postfix"
  22.         $POSTFIX start
  23.         rc=$?
  24.         echo "."
  25.         ;;
  26.  
  27.     stop)
  28.         echo -n "Stopping Postfix"
  29.         $POSTFIX stop
  30.         rc=$?
  31.         echo "."
  32.         ;;
  33.  
  34.     restart)
  35.         echo -n "Restarting Postfix"
  36.         $POSTFIX stop
  37.         rc=$?
  38.         echo "."
  39.         ;;
  40.  
  41.     *)
  42.         echo "Usage: $0 {start|stop|restart}"
  43.         rc=1
  44.  
  45. esac
  46. exit $rc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement