summaryrefslogtreecommitdiff
path: root/conf/dist/kolabctl
diff options
context:
space:
mode:
Diffstat (limited to 'conf/dist/kolabctl')
-rw-r--r--conf/dist/kolabctl96
1 files changed, 96 insertions, 0 deletions
diff --git a/conf/dist/kolabctl b/conf/dist/kolabctl
new file mode 100644
index 0000000..069236f
--- /dev/null
+++ b/conf/dist/kolabctl
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+function usage() {
+ echo "Usage: $0 <status|start|stop|restart> [service]"
+ echo ""
+ echo "Restart, start or stop the services that concern Kolab Groupware."
+ echo ""
+ echo "Specify 'all' for service to restart, stop or start all services."
+ exit 1
+}
+
+if [ $# -lt 2 -o $# -gt 3 ]; then
+ usage
+fi
+
+debug=0
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ status|start|stop|restart)
+ action=$1
+ shift
+ ;;
+
+ --debug)
+ debug=1
+ shift
+ ;;
+
+ *)
+ service=$1
+ shift
+ ;;
+
+ esac
+done
+
+declare -a services
+declare -a service_providers
+
+services[${#services[@]}]=ldap; service_providers[${#service_providers[@]}]=ldap
+services[${#services[@]}]=ldap; service_providers[${#service_providers[@]}]=dirsrv
+
+services[${#services[@]}]=mta; service_providers[${#service_providers[@]}]=sendmail
+services[${#services[@]}]=mta; service_providers[${#service_providers[@]}]=postfix
+services[${#services[@]}]=mta; service_providers[${#service_providers[@]}]=exim
+services[${#services[@]}]=mta; service_providers[${#service_providers[@]}]=qmail
+
+services[${#services[@]}]=imap; service_providers[${#service_providers[@]}]=cyrus
+services[${#services[@]}]=imap; service_providers[${#service_providers[@]}]=cyrus-imapd
+services[${#services[@]}]=imap; service_providers[${#service_providers[@]}]=kolab-cyrus-imapd
+services[${#services[@]}]=imap; service_providers[${#service_providers[@]}]=imapd
+services[${#services[@]}]=imap; service_providers[${#service_providers[@]}]=dovecot
+
+services[${#services[@]}]=httpd; service_providers[${#service_providers[@]}]=apache2
+services[${#services[@]}]=httpd; service_providers[${#service_providers[@]}]=httpd
+
+services[${#services[@]}]=antispam; service_providers[${#service_providers[@]}]=spamassassin
+services[${#services[@]}]=antispam; service_providers[${#service_providers[@]}]=spamd
+services[${#services[@]}]=antispam; service_providers[${#service_providers[@]}]=amavisd
+
+services[${#services[@]}]=antivirus; service_providers[${#service_providers[@]}]=clamd
+services[${#services[@]}]=antivirus; service_providers[${#service_providers[@]}]=clamd.amavisd
+services[${#services[@]}]=antivirus; service_providers[${#service_providers[@]}]=clamav-daemon
+services[${#services[@]}]=antivirus; service_providers[${#service_providers[@]}]=clamav
+services[${#services[@]}]=antivirus; service_providers[${#service_providers[@]}]=freshclam
+services[${#services[@]}]=antivirus; service_providers[${#service_providers[@]}]=clamav-freshclam
+
+service_num=0
+
+while [ ${service_num} -lt ${#services[@]} ]; do
+
+ if [ "${service}" == "all" -o \
+ "${service}" == "${services[${service_num}]}" -o \
+ "${service}" == "${service_providers[${service_num}]}" \
+ ]; then
+
+ [ ${debug} -gt 0 ] && \
+ echo "Checking service ${services[${service_num}]}, provider ${service_providers[${service_num}]}..."
+
+ service_provider=${service_providers[${service_num}]}
+
+ if [ -x "/etc/rc.d/init.d/${service_provider}" ]; then
+ [ ${debug} -gt 0 ] && \
+ echo "Service ${services[${service_num}]} / provider ${service_providers[${service_num}]} found."
+
+ /etc/rc.d/init.d/${service_provider} $action
+
+ else
+ [ ${debug} -gt 0 ] && \
+ echo "Service ${services[${service_num}]} / provider ${service_providers[${service_num}]} not installed."
+ fi
+ fi
+
+ let service_num++;
+done