-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-main
executable file
·58 lines (51 loc) · 1.6 KB
/
run-main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
# $Id$
# copyright (C) 2004 Topia <[email protected]>. all rights reserved.
if [ -z "${THISDIR}" ]; then
echo "$0 couldn't use directly. please use ./run." 1>&2
exit 2;
fi
[ "0${DEBUG}" -ge 1 ] && echo "${THISDIR}/run-main: start"
PERL=${PERL:-/usr/bin/perl}
PERLARG=${PERLARG:--w}
TIARRA=${TIARRA:-${TOPDIR}/tiarra}
CONF=${CONF:-tiarra.conf}
REDIR_STDOUT=${REDIR_STDOUT:->errlog.stdout}
REDIR_STDERR=${REDIR_STDERR:->errlog.stderr}
REDIR_STDIN=${REDIR_STDIN:-&-}
DAEMON_MODE=${DAEMON_MODE:-yes}
eval "${LAZY_EXECUTE}"
cmd_line='${PERL} ${PERLARG}'
cmd_line="${cmd_line} "'${TIARRA}'
cmd_line="${cmd_line} "'--config="${CONF}"'
cmd_line="${cmd_line} ${TIARRAARG}"
cmd_line="${cmd_line} "'"$@"'
[ "X${REDIR_STDOUT}" = "X-" ] || cmd_line="${cmd_line} >${REDIR_STDOUT}"
[ "X${REDIR_STDERR}" = "X-" ] || cmd_line="${cmd_line} 2>${REDIR_STDERR}"
[ "X${REDIR_STDIN}" = "X-" ] || cmd_line="${cmd_line} <${REDIR_STDIN}"
if [ "X${DAEMON_MODE}" = "Xyes" ]; then
cmd_line="${cmd_line} &"
else
cmd_line="exec ${cmd_line}"
fi
if [ \! -z "${DEBUG}" ]; then
echo " configuration"
echo "workdir : ${WORKDIR}"
echo "perl : ${PERL}"
echo "perl arg : ${PERLARG}"
echo "tiarra : ${TIARRA}"
echo "config : ${CONF}"
echo "tiarra arg: ${TIARRAARG}"
echo "extra : $@"
echo "stdout : ${REDIR_STDOUT}"
echo "stderr : ${REDIR_STDERR}"
echo "stdin : ${REDIR_STDIN}"
echo "daemon : ${DAEMON_MODE}"
echo "lazy exec : "
echo "${LAZY_EXECUTE}" | while read line ; do echo " $line" ; done
echo "cmdline :"
echo " ${cmd_line}"
else
cd "${WORKDIR}"
eval "${cmd_line}"
fi