Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 230 lines (204 sloc) 6.46 kB
21abc5b @klacke Initial revision
authored
1 #!/bin/sh
f6a5b93 @klacke ""
authored
2
28e4c73 @klacke first attempt to run properly under cygwin
authored
3 yawsdir="%yawsdir%"
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
4 vardir="%vardir%"
28e4c73 @klacke first attempt to run properly under cygwin
authored
5 erl="%erl%"
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
6 run_erl="%run_erl%"
7 to_erl="%to_erl%"
8
28e4c73 @klacke first attempt to run properly under cygwin
authored
9 case `uname` in
10 CYGWIN*)
0be3c7e @klacke untabified all of yaws
authored
11 yawsdir=`cygpath --windows $yawsdir`
12 werl="%werl%"
13 delim=\\;;
28e4c73 @klacke first attempt to run properly under cygwin
authored
14 *)
15 delim=/
16 esac
21abc5b @klacke Initial revision
authored
17
18
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
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
22
21abc5b @klacke Initial revision
authored
23 help()
24 {
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
25 echo "usage: "
26 echo ""
27 echo
c9cd304 @klacke git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk…
authored
28 echo " yaws -i | --interactive -- interactive (no daemon) mode"
29 echo " yaws -w | --winteractive -- cygwin interactive (werl) "
30 echo " yaws --daemon -- daemon mode"
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
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"
c9cd304 @klacke git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk…
authored
51 echo " --setcookie X -- set an erlang cookie"
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
52 echo " --run_erl X -- use run_erl with pipe-id X"
53 echo " --to_erl X -- connect to pipe-id X"
54
55 echo ""
56
57 echo "ctl functions ... "
58 echo " yaws --hup [--id ID] -- hup the daemon, reload conf"
1835867 @klacke *** empty log message ***
authored
59 echo " yaws --stop [--id ID] -- stop the daemon "
5207102 @klacke Added debug dump functionality
authored
60 echo " yaws --debug-dump [--id ID]-- produce a debug dump "
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
61 echo " yaws --status [--id ID] -- query the daemon status "
62 echo " yaws --load Modules -- load modules "
63 echo " yaws --ls -- list Yaws nodes and their status"
64 echo " yaws --ctltrace traffic|http -- toggle trace of running daemon"
65 echo " yaws --check YawsFile [IncDirs] -- test compile File "
66 exit 1
21abc5b @klacke Initial revision
authored
67 }
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
68
69
21abc5b @klacke Initial revision
authored
70
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored
71 debug="";
38fb85e @klacke ""
authored
72 daemon="";
73 interactive="";
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored
74 trace="";
75 conf="";
76 runmod="";
ab3a6d0 Added the '-sname <Node>' switch to the yaws script
Tobbe Tornquist authored
77 sname="";
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
78 heart="";
767ff08 added -pa switch to the yaws start script
Tobbe Tornquist authored
79 xpath="";
c7c87a4 @klacke -sname and mnesia flag added to start script
authored
80 mnesia="";
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
81 id="default";
4d59534 @klacke ""
authored
82 pdist=""
37e9d70 @klacke -erlarg patch by Fredrik Thulin
authored
83 erlarg=""
21abc5b @klacke Initial revision
authored
84
85 while [ $# -gt 0 ]
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
86 do
87 arg=$1
88 shift;
89 case $arg in
90 -i|--interactive)
0be3c7e @klacke untabified all of yaws
authored
91 interactive="true";
92 debug=" -yaws debug ";
93 daemon="";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
94 -w|--winteractive)
0be3c7e @klacke untabified all of yaws
authored
95 interactive="true";
96 debug=" -yaws debug ";
97 daemon="";
98 erl=$werl;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
99 -D|--daemon)
0be3c7e @klacke untabified all of yaws
authored
100 daemon=" -detached ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
101 -d|--debug)
0be3c7e @klacke untabified all of yaws
authored
102 debug=" -boot start_sasl -yaws debug ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
103 -t|--tracetraf)
0be3c7e @klacke untabified all of yaws
authored
104 trace=" -yaws trace traffic ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
105 -T|--tracehttp)
0be3c7e @klacke untabified all of yaws
authored
106 trace=" -yaws trace http ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
107 -I|--id)
0be3c7e @klacke untabified all of yaws
authored
108 id=$1
109 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
110 -x|--traceout)
0be3c7e @klacke untabified all of yaws
authored
111 traceoutput=" -yaws traceoutput ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
112 --trace)
0be3c7e @klacke untabified all of yaws
authored
113 traceoutput=" -yaws traceoutput ";
114 trace=" -yaws trace traffic ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
115 -M|--mnesiadir)
91a5018 @klacke quote patch for mnesiadir by Richard Bucker
authored
116 mnesia=" -mnesia dir '\"$1\"' -run mnesia start"
0be3c7e @klacke untabified all of yaws
authored
117 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
118 -c|--conf)
0be3c7e @klacke untabified all of yaws
authored
119 conf=" -conf $1 "
120 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
121 -pa|--pa)
0be3c7e @klacke untabified all of yaws
authored
122 xpath=" ${xpath} -pa $1 "
123 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
124 -r|--runmod)
0be3c7e @klacke untabified all of yaws
authored
125 runmod=" -runmod $1 "
126 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
127 -h|--hup)
0be3c7e @klacke untabified all of yaws
authored
128 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl hup";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
129 -s|--stop)
0be3c7e @klacke untabified all of yaws
authored
130 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl stop";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
131 -ls|--ls)
0be3c7e @klacke untabified all of yaws
authored
132 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl ls";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
133 -S|--status)
0be3c7e @klacke untabified all of yaws
authored
134 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl status";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
135 -load|--load)
0be3c7e @klacke untabified all of yaws
authored
136 $erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl load ${id} $*
137 exit 0;;
5207102 @klacke Added debug dump functionality
authored
138 --debug-dump)
139 $erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl debug_dump ${id}
140 exit 0;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
141 -j|--ctltrace)
0be3c7e @klacke untabified all of yaws
authored
142 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl trace $1"
143 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
144 -v|--version)
0be3c7e @klacke untabified all of yaws
authored
145 exec $erl -noshell -pa ${yawsdir}${delim}ebin -s yaws printversion;
146 exit 0;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
147 --sname|-sname)
0be3c7e @klacke untabified all of yaws
authored
148 sname=" -sname $1 "
149 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
150 -name|--name)
0be3c7e @klacke untabified all of yaws
authored
151 sname=" -name $1 "
152 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
153 -heart|--heart)
0be3c7e @klacke untabified all of yaws
authored
154 heart=" -heart ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
155 -proto_dist|--proto_dist)
0be3c7e @klacke untabified all of yaws
authored
156 pdist=" -proto_dist $1 "
157 shift;;
9bda554 @klacke lost the setcookie arg to yaws script
authored
158 -setcookie|--setcookie)
159 erlarg="$erlarg -setcookie $1 "
160 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
161 -erlarg|--erlarg)
0be3c7e @klacke untabified all of yaws
authored
162 erlarg="$erlarg $1 "
163 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
164 -check|--check)
0be3c7e @klacke untabified all of yaws
authored
165 mkdir ${HOME}/.yaws/ 2> /dev/null
166 mkdir ${HOME}/.yaws/${ID} 2> /dev/null
167 out=`exec $erl -noshell -pa ${yawsdir}${delim}ebin ${xpath} -s yaws_ctl check ${id} $*`
168 if [ "$?" = "0" ]; then
169 echo "$out"
170 echo "$1" ok
171 exit 0
172 fi
173 echo "$out"
174 exit 1;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
175 --to_erl)
0be3c7e @klacke untabified all of yaws
authored
176 TO_ERL=yes
177 PIPE_DIR="${vardir}/run/yaws/pipe/$1"
178 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
179 --run_erl)
0be3c7e @klacke untabified all of yaws
authored
180 RUN_ERL=yes
181 daemon=""
182 PIPE_DIR="${vardir}/run/yaws/pipe/$1"
183 LOG_DIR="${vardir}/log/yaws/erlang-log/$1"
184 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
185 *)
0be3c7e @klacke untabified all of yaws
authored
186 help
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
187 esac
21abc5b @klacke Initial revision
authored
188 done
189
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
190
191 if [ ! -z "${ex}" ]; then
192 exec ${ex} ${id}
193 exit 0
194 fi
195
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
196 if [ -n "$TO_ERL" ]; then
197 $to_erl $PIPE_DIR/
198 exit 0
199 fi
200
201 if [ -n "$RUN_ERL" ]; then
202 if [ ! -d $LOG_DIR ]; then
0be3c7e @klacke untabified all of yaws
authored
203 mkdir -p $LOG_DIR
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
204 fi
205 if [ ! -d $PIPE_DIR ]; then
0be3c7e @klacke untabified all of yaws
authored
206 mkdir -p $PIPE_DIR
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
207 fi
208 RUN_ERL="$run_erl -daemon $PIPE_DIR/ $LOG_DIR"
209 else
210 RUN_ERL="eval"
211 fi
212
92bafb4 @klacke removed the ability change userid, also stopped writing to /tmp/yaws …
authored
213 if [ ! -z "${id}" ]; then
214 id="-yaws id ${id}"
215 fi
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
216
82d6e29 @klacke added -x flag for tty trace and did the 1.3 release
authored
217 trace="${trace} ${traceoutput}"
218
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
219 [ "$run_erl" = "eval" ] && [ -z "$daemon" ] && [ -z "$interactive" ] && help
220
221 XEC="${daemon} ${heart} -pa ${yawsdir}${delim}ebin ${xpath} ${sname} ${pdist} ${erlarg} ${debug} -run yaws ${trace} ${conf} ${runmod} ${mnesia} ${id}"
38fb85e @klacke ""
authored
222
f22e6e8 Fixed heart bug
Johan Bevemyr authored
223 if [ -z "$heart" ] || [ -z "$daemon" ]; then
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
224 HEART_COMMAND="";
225 else
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
226 export HEART_COMMAND="${ENV_PGM} HEART=true \"$erl\" $XEC";
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
227 fi
228
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
229 ${RUN_ERL} "exec $erl $XEC"
Something went wrong with that request. Please try again.