Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

postfixadmin-mailbox-postcreation.sh 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh
  2. # Example script for adding a Maildir to a Courier-IMAP virtual mail
  3. # hierarchy.
  4. # The script only looks at argument 3, assuming that it
  5. # indicates the relative name of a maildir, such as
  6. # "somedomain.com/peter/".
  7. # This script should be run as the user which owns the maildirs. If
  8. # the script is actually run by the apache user (e.g. through PHP),
  9. # then you could use "sudo" to grant apache the rights to run
  10. # this script as the relevant user.
  11. # Assume this script has been saved as
  12. # /usr/local/bin/postfixadmin-mailbox-postcreation.sh and has been
  13. # made executable. Now, an example /etc/sudoers line:
  14. # apache ALL=(courier) NOPASSWD: /usr/local/bin/postfixadmin-mailbox-postcreation.sh
  15. # The line states that the apache user may run the script as the
  16. # user "courier" without providing a password.
  17. # Change this to where you keep your virtual mail users' maildirs.
  18. basedir=/var/spool/maildirs
  19. if [ ! -e "$basedir" ]; then
  20. echo "$0: basedir '$basedir' does not exist; bailing out."
  21. exit 1
  22. fi
  23. if [ `echo $3 | fgrep '..'` ]; then
  24. echo "$0: An argument contained a double-dot sequence; bailing out."
  25. exit 1
  26. fi
  27. maildir="${basedir}/$3"
  28. parent=`dirname "$maildir"`
  29. if [ ! -d "$parent" ]; then
  30. if [ -e "$parent" ]; then
  31. echo "$0: strange - directory '$parent' exists, but is not a directory; bailing out."
  32. exit 1
  33. else
  34. mkdir -p "${parent}"
  35. if [ $? -ne 0 ]; then
  36. echo "$0: mkdir -p '$parent' returned non-zero; bailing out."
  37. exit 1
  38. fi
  39. fi
  40. fi
  41. if [ -e "$maildir" ]; then
  42. echo "$0: Directory '$maildir' already exists! bailing out"
  43. exit 1
  44. fi
  45. maildirmake "$maildir"
  46. if [ ! -d "$maildir" ]; then
  47. echo "$0: maildirmake didn't produce a directory; bailing out."
  48. exit 1
  49. fi
  50. exit 0