Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 223 lines (197 sloc) 6.181 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 "
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
60 echo " yaws --status [--id ID] -- query the daemon status "
61 echo " yaws --load Modules -- load modules "
62 echo " yaws --ls -- list Yaws nodes and their status"
63 echo " yaws --ctltrace traffic|http -- toggle trace of running daemon"
64 echo " yaws --check YawsFile [IncDirs] -- test compile File "
65 exit 1
21abc5b @klacke Initial revision
authored
66 }
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
67
68
21abc5b @klacke Initial revision
authored
69
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored
70 debug="";
38fb85e @klacke ""
authored
71 daemon="";
72 interactive="";
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored
73 trace="";
74 conf="";
75 runmod="";
ab3a6d0 Added the '-sname <Node>' switch to the yaws script
Tobbe Tornquist authored
76 sname="";
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
77 heart="";
767ff08 added -pa switch to the yaws start script
Tobbe Tornquist authored
78 xpath="";
c7c87a4 @klacke -sname and mnesia flag added to start script
authored
79 mnesia="";
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
80 id="default";
4d59534 @klacke ""
authored
81 pdist=""
37e9d70 @klacke -erlarg patch by Fredrik Thulin
authored
82 erlarg=""
21abc5b @klacke Initial revision
authored
83
84 while [ $# -gt 0 ]
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
85 do
86 arg=$1
87 shift;
88 case $arg in
89 -i|--interactive)
0be3c7e @klacke untabified all of yaws
authored
90 interactive="true";
91 debug=" -yaws debug ";
92 daemon="";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
93 -w|--winteractive)
0be3c7e @klacke untabified all of yaws
authored
94 interactive="true";
95 debug=" -yaws debug ";
96 daemon="";
97 erl=$werl;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
98 -D|--daemon)
0be3c7e @klacke untabified all of yaws
authored
99 daemon=" -detached ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
100 -d|--debug)
0be3c7e @klacke untabified all of yaws
authored
101 debug=" -boot start_sasl -yaws debug ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
102 -t|--tracetraf)
0be3c7e @klacke untabified all of yaws
authored
103 trace=" -yaws trace traffic ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
104 -T|--tracehttp)
0be3c7e @klacke untabified all of yaws
authored
105 trace=" -yaws trace http ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
106 -I|--id)
0be3c7e @klacke untabified all of yaws
authored
107 id=$1
108 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
109 -x|--traceout)
0be3c7e @klacke untabified all of yaws
authored
110 traceoutput=" -yaws traceoutput ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
111 --trace)
0be3c7e @klacke untabified all of yaws
authored
112 traceoutput=" -yaws traceoutput ";
113 trace=" -yaws trace traffic ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
114 -M|--mnesiadir)
91a5018 @klacke quote patch for mnesiadir by Richard Bucker
authored
115 mnesia=" -mnesia dir '\"$1\"' -run mnesia start"
0be3c7e @klacke untabified all of yaws
authored
116 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
117 -c|--conf)
0be3c7e @klacke untabified all of yaws
authored
118 conf=" -conf $1 "
119 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
120 -pa|--pa)
0be3c7e @klacke untabified all of yaws
authored
121 xpath=" ${xpath} -pa $1 "
122 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
123 -r|--runmod)
0be3c7e @klacke untabified all of yaws
authored
124 runmod=" -runmod $1 "
125 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
126 -h|--hup)
0be3c7e @klacke untabified all of yaws
authored
127 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl hup";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
128 -s|--stop)
0be3c7e @klacke untabified all of yaws
authored
129 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl stop";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
130 -ls|--ls)
0be3c7e @klacke untabified all of yaws
authored
131 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl ls";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
132 -S|--status)
0be3c7e @klacke untabified all of yaws
authored
133 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl status";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
134 -load|--load)
0be3c7e @klacke untabified all of yaws
authored
135 $erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl load ${id} $*
136 exit 0;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
137 -j|--ctltrace)
0be3c7e @klacke untabified all of yaws
authored
138 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl trace $1"
139 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
140 -v|--version)
0be3c7e @klacke untabified all of yaws
authored
141 exec $erl -noshell -pa ${yawsdir}${delim}ebin -s yaws printversion;
142 exit 0;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
143 --sname|-sname)
0be3c7e @klacke untabified all of yaws
authored
144 sname=" -sname $1 "
145 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
146 -name|--name)
0be3c7e @klacke untabified all of yaws
authored
147 sname=" -name $1 "
148 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
149 -heart|--heart)
0be3c7e @klacke untabified all of yaws
authored
150 heart=" -heart ";;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
151 -proto_dist|--proto_dist)
0be3c7e @klacke untabified all of yaws
authored
152 pdist=" -proto_dist $1 "
153 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
154 -erlarg|--erlarg)
0be3c7e @klacke untabified all of yaws
authored
155 erlarg="$erlarg $1 "
156 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
157 -check|--check)
0be3c7e @klacke untabified all of yaws
authored
158 mkdir ${HOME}/.yaws/ 2> /dev/null
159 mkdir ${HOME}/.yaws/${ID} 2> /dev/null
160 out=`exec $erl -noshell -pa ${yawsdir}${delim}ebin ${xpath} -s yaws_ctl check ${id} $*`
161 if [ "$?" = "0" ]; then
162 echo "$out"
163 echo "$1" ok
164 exit 0
165 fi
166 echo "$out"
167 exit 1;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
168 --to_erl)
0be3c7e @klacke untabified all of yaws
authored
169 TO_ERL=yes
170 PIPE_DIR="${vardir}/run/yaws/pipe/$1"
171 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
172 --run_erl)
0be3c7e @klacke untabified all of yaws
authored
173 RUN_ERL=yes
174 daemon=""
175 PIPE_DIR="${vardir}/run/yaws/pipe/$1"
176 LOG_DIR="${vardir}/log/yaws/erlang-log/$1"
177 shift;;
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
178 *)
0be3c7e @klacke untabified all of yaws
authored
179 help
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
180 esac
21abc5b @klacke Initial revision
authored
181 done
182
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
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
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
0be3c7e @klacke untabified all of yaws
authored
196 mkdir -p $LOG_DIR
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
197 fi
198 if [ ! -d $PIPE_DIR ]; then
0be3c7e @klacke untabified all of yaws
authored
199 mkdir -p $PIPE_DIR
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
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
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
209
82d6e29 @klacke added -x flag for tty trace and did the 1.3 release
authored
210 trace="${trace} ${traceoutput}"
211
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
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
215
f22e6e8 Fixed heart bug
Johan Bevemyr authored
216 if [ -z "$heart" ] || [ -z "$daemon" ]; then
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
217 HEART_COMMAND="";
218 else
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
219 export HEART_COMMAND="${ENV_PGM} HEART=true \"$erl\" $XEC";
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
220 fi
221
28972a3 @klacke run_erl to_erl support patch from Mats Cronquist
authored
222 ${RUN_ERL} "exec $erl $XEC"
Something went wrong with that request. Please try again.