Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 170 lines (145 sloc) 4.351 kb
21abc5b @klacke Initial revision
authored
1 #!/bin/sh
f6a5b93 @klacke ""
authored
2
21abc5b @klacke Initial revision
authored
3
28e4c73 @klacke first attempt to run properly under cygwin
authored
4 yawsdir="%yawsdir%"
5 erl="%erl%"
6 case `uname` in
7 CYGWIN*)
8 yawsdir=`cygpath --windows $yawsdir`
9 werl="%werl%"
10 delim=\\;;
11 *)
12 delim=/
13 esac
21abc5b @klacke Initial revision
authored
14
15
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
16 ENV_PGM=`which env`
17
18
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
19
21abc5b @klacke Initial revision
authored
20 help()
21 {
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
22 echo "usage: "
23 echo ""
24 echo
25 echo " yaws -i -- interactive (no daemon) mode"
28e4c73 @klacke first attempt to run properly under cygwin
authored
26 echo " yaws -w -- cygwin interactive (werl) "
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
27 echo " yaws -D -- daemon mode"
28
29 echo ""
30
31 echo ""
32 echo " Auxilliary flags for the daemon: "
33 echo " -I Id -- Set system id"
34 echo " -d -- debug mode "
35 echo " -c File -- set config file"
36 echo " -r mod -- call mod:start/0 at startup"
37 echo " -t -- trace all traffic"
38 echo " -T -- trace http traffic"
39 echo " -x -- trace output to stdout"
40 echo " -v -- print version"
41 echo " -pa path -- add path"
42 echo " -M dir -- start Mnesia in dir"
43 echo " -sname xxx -- start with sname xxx"
44 echo " -r mod -- call mod:start/0 at startup"
45 echo " -heart -- auto restart yaws if it crashes"
46
47 echo ""
48
49 echo "ctl functions ... "
50 echo " yaws -h [-I id] -- hup the daemon "
51 echo " yaws -s [-I id] -- stop the daemon "
52 echo " yaws -S [-I id] -- query the daemon status "
53 echo " yaws -load Modules -- load modules "
54 echo " yaws -j traffic|http -- toggle trace of running daemon"
55 echo " yaws -check YawsFile [IncDirs] -- test compile File "
56 exit 1
21abc5b @klacke Initial revision
authored
57 }
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
58
59
21abc5b @klacke Initial revision
authored
60
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored
61 debug="";
38fb85e @klacke ""
authored
62 daemon="";
63 interactive="";
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored
64 trace="";
65 conf="";
66 runmod="";
ab3a6d0 Added the '-sname <Node>' switch to the yaws script
Tobbe Tornquist authored
67 sname="";
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
68 heart="";
767ff08 added -pa switch to the yaws start script
Tobbe Tornquist authored
69 xpath="";
c7c87a4 @klacke -sname and mnesia flag added to start script
authored
70 mnesia="";
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
71 id="default";
21abc5b @klacke Initial revision
authored
72
73 while [ $# -gt 0 ]
74 do
75 arg=$1
76 shift;
77 case $arg in
78 -i)
38fb85e @klacke ""
authored
79 interactive="true";
0d7291a @klacke ""
authored
80 debug=" -yaws debug ";
d5201c6 @klacke ""
authored
81 daemon="";;
28e4c73 @klacke first attempt to run properly under cygwin
authored
82 -w)
83 interactive="true";
84 debug=" -yaws debug ";
85 daemon="";
86 erl=$werl;;
38fb85e @klacke ""
authored
87 -D)
88 daemon=" -detached ";;
21abc5b @klacke Initial revision
authored
89 -d)
d5201c6 @klacke ""
authored
90 debug=" -boot start_sasl -yaws debug ";;
961926f @klacke ""
authored
91 -t)
08375a9 @klacke ""
authored
92 trace=" -yaws trace traffic ";;
93 -T)
94 trace=" -yaws trace http ";;
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
95 -I)
96 id=$1
97 shift;;
82d6e29 @klacke added -x flag for tty trace and did the 1.3 release
authored
98 -x)
99 traceoutput=" -yaws traceoutput ";;
c7c87a4 @klacke -sname and mnesia flag added to start script
authored
100 -M)
101 mnesia=" -mnesia dir '"$1"' -run mnesia start"
102 shift;;
21abc5b @klacke Initial revision
authored
103 -c)
961926f @klacke ""
authored
104 conf=" -conf $1 "
d5201c6 @klacke ""
authored
105 shift;;
767ff08 added -pa switch to the yaws start script
Tobbe Tornquist authored
106 -pa)
107 xpath=" ${xpath} -pa $1 "
108 shift;;
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored
109 -r)
110 runmod=" -runmod $1 "
111 shift;;
38fb85e @klacke ""
authored
112 -h)
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
113 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl hup";;
38fb85e @klacke ""
authored
114 -s)
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
115 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl stop";;
6377222 @klacke ""
authored
116 -S)
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
117 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl status";;
caa1a72 @carsten3347 Added command `-load' to yaws script.
carsten3347 authored
118 -load)
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
119 $erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl load ${id} $*
caa1a72 @carsten3347 Added command `-load' to yaws script.
carsten3347 authored
120 exit 0;;
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
121 -j)
122 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl trace $1"
123 shift;;
639b7c2 @klacke ""
authored
124 -v)
28e4c73 @klacke first attempt to run properly under cygwin
authored
125 exec $erl -noshell -pa ${yawsdir}${delim}ebin -s yaws printversion;
dcc3217 @klacke ""
authored
126 exit 0;;
ab3a6d0 Added the '-sname <Node>' switch to the yaws script
Tobbe Tornquist authored
127 -sname)
128 sname=" -sname $1 "
129 shift;;
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
130 -heart)
131 heart=" -heart ";;
2f51c68 @klacke -check arg
authored
132 -check)
2eeee0d @klacke ""
authored
133 ID=`id -u`
134 mkdir /tmp/yaws 2> /dev/null
135 mkdir /tmp/yaws/${ID} 2> /dev/null
767ff08 added -pa switch to the yaws start script
Tobbe Tornquist authored
136 out=`exec $erl -noshell -pa ${yawsdir}${delim}ebin ${xpath} -s yaws_ctl check $*`
2f51c68 @klacke -check arg
authored
137 if [ "$out" = "ok" ]; then
12cb27f @klacke ""
authored
138 echo "$1" ok
2f51c68 @klacke -check arg
authored
139 exit 0
140 fi
141 echo $out
142 exit 1;;
21abc5b @klacke Initial revision
authored
143 *)
144 help
145 esac
146 done
147
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
148
149 if [ ! -z "${ex}" ]; then
150 exec ${ex} ${id}
151 exit 0
152 fi
153
154
82d6e29 @klacke added -x flag for tty trace and did the 1.3 release
authored
155 trace="${trace} ${traceoutput}"
156
38fb85e @klacke ""
authored
157 [ -z "$daemon" ] && [ -z "$interactive" ] && help
158
f22e6e8 Fixed heart bug
Johan Bevemyr authored
159 if [ -z "$heart" ] || [ -z "$daemon" ]; then
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
160 HEART_COMMAND="";
161 else
162 ## ............................this line
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
163 export HEART_COMMAND="${ENV_PGM} HEART=true \"$erl\" ${daemon} ${heart} -pa ${yawsdir}${delim}ebin ${xpath} ${sname} ${debug} -s yaws $trace $conf $runmod $mnesia";
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
164 fi
165
166 ## keep this line in sync with ....^
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id su…
authored
167 exec "$erl" ${daemon} ${heart} -pa ${yawsdir}${delim}ebin ${xpath} ${sname} ${debug} -s yaws $trace $conf $runmod $mnesia
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored
168
21abc5b @klacke Initial revision
authored
169
Something went wrong with that request. Please try again.