#!/bin/sh
get_log_name() {
# $1 - initial name
# $2 - variable suffix to make sure that file is writable (must be omitted initially)
	local f="$1$2"
	touch "$f"
	if [ -w "$f" ]; then
		echo "$f"
		return 0
	fi
	get_log_name "$1" "$((${2:-0}+1))"
}
log_name=/tmp/shhv.app_$(id -un)_log
log_name=$(get_log_name "$log_name")
"$0.app" "$@" >"$log_name" 2>&1
status=$?
if [ $status -ne 127 ]; then
	exit $status
fi
LD_LIBRARY_PATH="/opt/smfp-common/lib:$LD_LIBRARY_PATH" "$0.app" "$@"
