Skip to content
Newer
Older
100755 223 lines (197 sloc) 5.62 KB
21abc5b @klacke Initial revision
authored Feb 11, 2002
1 #!/bin/sh
f6a5b93 @klacke ""
authored Mar 21, 2004
2
28e4c73 @klacke first attempt to run properly under cygwin
authored Sep 8, 2003
3 yawsdir="%yawsdir%"
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored May 30, 2006
4 vardir="%vardir%"
28e4c73 @klacke first attempt to run properly under cygwin
authored Sep 8, 2003
5 erl="%erl%"
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored May 30, 2006
6 run_erl="%run_erl%"
7 to_erl="%to_erl%"
8
28e4c73 @klacke first attempt to run properly under cygwin
authored Sep 8, 2003
9 case `uname` in
10 CYGWIN*)
11 yawsdir=`cygpath --windows $yawsdir`
12 werl="%werl%"
13 delim=\\;;
14 *)
15 delim=/
16 esac
21abc5b @klacke Initial revision
authored Feb 11, 2002
17
18
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored Jun 20, 2002
19 ENV_PGM=`which env`
20
21
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
22
21abc5b @klacke Initial revision
authored Feb 11, 2002
23 help()
24 {
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored May 30, 2006
25 echo "usage: "
26 echo ""
27 echo
28 echo " yaws -i | --interactive -- interactive (no daemon) mode"
29 echo " yaws -w | --winteractive -- cygwin interactive (werl) "
30 echo " yaws --daemon -- daemon mode"
31
32 echo ""
33
34 echo ""
35 echo " Auxilliary flags for the daemon: "
36 echo " --id Id -- Set system id"
37 echo " --debug -- debug mode "
38 echo " --conf File -- set config file"
39 echo " --tracetraf -- trace traffic"
40 echo " --tracehttp -- trace http traffic"
41 echo " --traceout -- trace output to stdout"
42 echo " --version -- print version"
43 echo " --pa path -- add load path"
44 echo " --mnesiadir dir -- start Mnesia in dir"
45 echo " --proto_dist Mod -- use Mod for distrib"
46 echo " --sname xxx -- start with sname xxx"
47 echo " --name xxx -- start with name xxx"
48 echo " --runmod mod -- call mod:start/0 at startup"
49 echo " --heart -- auto restart yaws if it crashes"
50 echo " --erlarg X -- pass argument X to $erl"
51 echo " --run_erl X -- use run_erl with pipe-id X"
52 echo " --to_erl X -- connect to pipe-id X"
53
54 echo ""
55
56 echo "ctl functions ... "
57 echo " yaws --hup [--id ID] -- hup the daemon, reload conf"
58 echo " yaws --stops [--id ID] -- stop the daemon "
59 echo " yaws --status [--id ID] -- query the daemon status "
60 echo " yaws --load Modules -- load modules "
61 echo " yaws --ls -- list Yaws nodes and their status"
62 echo " yaws --ctltrace traffic|http -- toggle trace of running daemon"
63 echo " yaws --check YawsFile [IncDirs] -- test compile File "
64 exit 1
21abc5b @klacke Initial revision
authored Feb 11, 2002
65 }
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
66
67
21abc5b @klacke Initial revision
authored Feb 11, 2002
68
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored Jun 17, 2002
69 debug="";
38fb85e @klacke ""
authored Apr 30, 2002
70 daemon="";
71 interactive="";
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored Jun 17, 2002
72 trace="";
73 conf="";
74 runmod="";
ab3a6d0 Added the '-sname <Node>' switch to the yaws script
Tobbe Tornquist authored Jun 19, 2002
75 sname="";
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored Jun 20, 2002
76 heart="";
767ff08 added -pa switch to the yaws start script
Tobbe Tornquist authored Mar 10, 2004
77 xpath="";
c7c87a4 @klacke -sname and mnesia flag added to start script
authored Aug 25, 2003
78 mnesia="";
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
79 id="default";
4d59534 @klacke ""
authored May 18, 2005
80 pdist=""
37e9d70 @klacke -erlarg patch by Fredrik Thulin
authored Jun 7, 2005
81 erlarg=""
21abc5b @klacke Initial revision
authored Feb 11, 2002
82
83 while [ $# -gt 0 ]
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored May 30, 2006
84 do
85 arg=$1
86 shift;
87 case $arg in
88 -i|--interactive)
89 interactive="true";
90 debug=" -yaws debug ";
91 daemon="";;
92 -w|--winteractive)
93 interactive="true";
94 debug=" -yaws debug ";
95 daemon="";
96 erl=$werl;;
97 -D|--daemon)
98 daemon=" -detached ";;
99 -d|--debug)
100 debug=" -boot start_sasl -yaws debug ";;
101 -t|--tracetraf)
102 trace=" -yaws trace traffic ";;
103 -T|--tracehttp)
104 trace=" -yaws trace http ";;
105 -I|--id)
106 id=$1
107 shift;;
108 -x|--traceout)
109 traceoutput=" -yaws traceoutput ";;
110 --trace)
111 traceoutput=" -yaws traceoutput ";
112 trace=" -yaws trace traffic ";;
113 -M|--mnesiadir)
114 mnesia=" -mnesia dir '"$1"' -run mnesia start"
115 shift;;
116 -c|--conf)
117 conf=" -conf $1 "
118 shift;;
119 -pa|--pa)
120 xpath=" ${xpath} -pa $1 "
121 shift;;
122 -r|--runmod)
123 runmod=" -runmod $1 "
124 shift;;
125 -h|--hup)
126 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl hup";;
127 -s|--stop)
128 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl stop";;
129 -ls|--ls)
130 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl ls";;
131 -S|--status)
132 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl status";;
133 -load|--load)
134 $erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl load ${id} $*
135 exit 0;;
136 -j|--ctltrace)
137 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl trace $1"
138 shift;;
139 -v|--version)
140 exec $erl -noshell -pa ${yawsdir}${delim}ebin -s yaws printversion;
141 exit 0;;
142 --sname|-sname)
143 sname=" -sname $1 "
144 shift;;
145 -name|--name)
146 sname=" -name $1 "
147 shift;;
148 -heart|--heart)
149 heart=" -heart ";;
150 -proto_dist|--proto_dist)
151 pdist=" -proto_dist $1 "
152 shift;;
153 -erlarg|--erlarg)
154 erlarg="$erlarg $1 "
155 shift;;
156 -check|--check)
157 mkdir ${HOME}/.yaws/ 2> /dev/null
158 mkdir ${HOME}/.yaws/${ID} 2> /dev/null
159 out=`exec $erl -noshell -pa ${yawsdir}${delim}ebin ${xpath} -s yaws_ctl check ${id} $*`
160 if [ "$out" = "ok" ]; then
161 echo "$1" ok
162 exit 0
163 fi
164 echo $out
165 exit 1;;
166 --to_erl)
167 TO_ERL=yes
168 PIPE_DIR="${vardir}/run/yaws/pipe/$1"
169 shift;;
170 --run_erl)
171 RUN_ERL=yes
172 RUN_ERL_LOG_GENERATIONS=8 ; export RUN_ERL_LOG_GENERATIONS
173 RUN_ERL_LOG_MAXSIZE=1000000 ; export RUN_ERL_LOG_MAXSIZE
174 daemon=""
175 PIPE_DIR="${vardir}/run/yaws/pipe/$1"
176 LOG_DIR="${vardir}/log/yaws/erlang-log/$1"
177 shift;;
178 *)
179 help
180 esac
21abc5b @klacke Initial revision
authored Feb 11, 2002
181 done
182
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
183
184 if [ ! -z "${ex}" ]; then
185 exec ${ex} ${id}
186 exit 0
187 fi
188
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored May 30, 2006
189 if [ -n "$TO_ERL" ]; then
190 $to_erl $PIPE_DIR/
191 exit 0
192 fi
193
194 if [ -n "$RUN_ERL" ]; then
195 if [ ! -d $LOG_DIR ]; then
196 mkdir -p $LOG_DIR
197 fi
198 if [ ! -d $PIPE_DIR ]; then
199 mkdir -p $PIPE_DIR
200 fi
201 RUN_ERL="$run_erl -daemon $PIPE_DIR/ $LOG_DIR"
202 else
203 RUN_ERL="eval"
204 fi
205
92bafb4 @klacke removed the ability change userid, also stopped writing to /tmp/yaws …
authored Mar 9, 2006
206 if [ ! -z "${id}" ]; then
207 id="-yaws id ${id}"
208 fi
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored Mar 10, 2004
209
82d6e29 @klacke added -x flag for tty trace and did the 1.3 release
authored Aug 25, 2003
210 trace="${trace} ${traceoutput}"
211
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored May 30, 2006
212 [ "$run_erl" = "eval" ] && [ -z "$daemon" ] && [ -z "$interactive" ] && help
213
214 XEC="${daemon} ${heart} -pa ${yawsdir}${delim}ebin ${xpath} ${sname} ${pdist} ${erlarg} ${debug} -run yaws ${trace} ${conf} ${runmod} ${mnesia} ${id}"
38fb85e @klacke ""
authored Apr 30, 2002
215
f22e6e8 Fixed heart bug
Johan Bevemyr authored Jun 27, 2002
216 if [ -z "$heart" ] || [ -z "$daemon" ]; then
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored Jun 20, 2002
217 HEART_COMMAND="";
218 else
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored May 30, 2006
219 export HEART_COMMAND="${ENV_PGM} HEART=true \"$erl\" $XEC";
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored Jun 20, 2002
220 fi
221
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored May 30, 2006
222 ${RUN_ERL} "exec $erl $XEC"
Something went wrong with that request. Please try again.