[Devel] debian check_openser_config improvement
Dan Pascu
dan at ag-projects.com
Tue Dec 19 16:50:37 CET 2006
On Tuesday 19 December 2006 17:21, Juha Heinanen wrote:
> dan,
>
> only empty lines come out if i do as you suggested:
>
> out=$($DAEMON -c > /dev/null 2>&1)
It appears that a set of parentheses were removed in the above command at
some point. As it is it'll send all stdout/stderr to /dev/null, while the
purpose was to send only stdout to /dev/null and capture stderr in the
variable. So it should have read:
out=$(($DAEMON -c > /dev/null) 2>&1)
Anyway below is my check function in case anything else has been changed.
The version below works as I use it myself:
check_openser_config ()
{
# Check if openser configuration is valid before starting the
# server
set +e
out=$(($DAEMON -c > /dev/null) 2>&1)
retcode=$?
set -e
if [ "$retcode" != '0' ]; then
echo "Not starting $DESC: invalid configuration file!"
echo -e "\n$out\n"
exit 1
fi
}
--
Dan
More information about the Devel
mailing list