Code

Added mailqueue script
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 26 Mar 2008 12:59:14 +0000 (12:59 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 26 Mar 2008 12:59:14 +0000 (12:59 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@9994 594d385d-05f5-0310-b6e9-bd551577e9d8

contrib/scripts/mailqueue [new file with mode: 0755]

diff --git a/contrib/scripts/mailqueue b/contrib/scripts/mailqueue
new file mode 100755 (executable)
index 0000000..be6c872
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+# Are we root?
+[ $UID -ne 0 ] && exit 1
+
+# Assign parameters
+[ $# -lt 3 ] && exit 2
+action=$1
+shift
+id=$1
+shift
+
+# Servers are ignored by this script
+servers=$*
+
+# Take actions
+case "$action" in
+       query)
+               /usr/bin/mailq
+               ;;
+
+       hold)
+               /usr/sbin/postsuper -h $id
+               ;;
+
+       unhold)
+               /usr/sbin/postsuper -H $id
+               ;;
+
+       requeue)
+               /usr/sbin/postsuper -r $id
+               ;;
+
+       del)
+               /usr/sbin/postsuper -d $id
+               ;;
+
+       header)
+               queue=$(postconf queue_directory | cut -d\  -f3-)
+               postcat -q $id | sed -n '/^\*\*\* MESSAGE CONTENTS/,/^$/p' | sed "s#^\*\*\* MESSAGE CONTENTS \(.*\)\*\*\*#Filename: $queue/\1#"
+               ;;
+
+       *)      exit 3
+               ;;
+esac
+
+echo "Ready"