Ticket #14230: rabbitmqctl_wrapper

File rabbitmqctl_wrapper, 317 bytes (added by tonyg-macports@…, 17 years ago)

Wrapper script for su-ing to the rabbitmq user to control the daemon

Line 
1#!/bin/bash
2# Escape spaces and quotes, because shell is revolting.
3for arg in "$@" ; do
4        # Escape quotes in parameters, so that they're passed through cleanly.
5        arg=$(sed -e 's/"/\\"/' <<-END
6                $arg
7                END
8        )
9        CMDLINE="${CMDLINE} \"${arg}\""
10done
11
12cd /
13exec su rabbitmq -c "@PREFIX@/sbin/rabbitmqctl_real ${CMDLINE}"