Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 180 lines (155 sloc) 4.707 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 suppo...
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 suppo...
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 suppo...
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"
4d59534 @klacke ""
authored
43 echo " -proto_dist Mod -- use Mod for distrib
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id suppo...
authored
44 echo " -sname xxx -- start with sname xxx"
4d59534 @klacke ""
authored
45 echo " -name xxx -- start with name xxx"
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id suppo...
authored
46 echo " -r mod -- call mod:start/0 at startup"
47 echo " -heart -- auto restart yaws if it crashes"
48
49 echo ""
50
51 echo "ctl functions ... "
52 echo " yaws -h [-I id] -- hup the daemon "
53 echo " yaws -s [-I id] -- stop the daemon "
54 echo " yaws -S [-I id] -- query the daemon status "
55 echo " yaws -load Modules -- load modules "
56 echo " yaws -j traffic|http -- toggle trace of running daemon"
57 echo " yaws -check YawsFile [IncDirs] -- test compile File "
58 exit 1
21abc5b @klacke Initial revision
authored
59 }
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id suppo...
authored
60
61
21abc5b @klacke Initial revision
authored
62
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored
63 debug="";
38fb85e @klacke ""
authored
64 daemon="";
65 interactive="";
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored
66 trace="";
67 conf="";
68 runmod="";
ab3a6d0 Added the '-sname <Node>' switch to the yaws script
Tobbe Tornquist authored
69 sname="";
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
70 heart="";
767ff08 added -pa switch to the yaws start script
Tobbe Tornquist authored
71 xpath="";
c7c87a4 @klacke -sname and mnesia flag added to start script
authored
72 mnesia="";
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id suppo...
authored
73 id="default";
4d59534 @klacke ""
authored
74 pdist=""
21abc5b @klacke Initial revision
authored
75
76 while [ $# -gt 0 ]
77 do
78 arg=$1
79 shift;
80 case $arg in
81 -i)
38fb85e @klacke ""
authored
82 interactive="true";
0d7291a @klacke ""
authored
83 debug=" -yaws debug ";
d5201c6 @klacke ""
authored
84 daemon="";;
28e4c73 @klacke first attempt to run properly under cygwin
authored
85 -w)
86 interactive="true";
87 debug=" -yaws debug ";
88 daemon="";
89 erl=$werl;;
38fb85e @klacke ""
authored
90 -D)
91 daemon=" -detached ";;
21abc5b @klacke Initial revision
authored
92 -d)
d5201c6 @klacke ""
authored
93 debug=" -boot start_sasl -yaws debug ";;
961926f @klacke ""
authored
94 -t)
08375a9 @klacke ""
authored
95 trace=" -yaws trace traffic ";;
96 -T)
97 trace=" -yaws trace http ";;
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id suppo...
authored
98 -I)
99 id=$1
100 shift;;
82d6e29 @klacke added -x flag for tty trace and did the 1.3 release
authored
101 -x)
102 traceoutput=" -yaws traceoutput ";;
c7c87a4 @klacke -sname and mnesia flag added to start script
authored
103 -M)
104 mnesia=" -mnesia dir '"$1"' -run mnesia start"
105 shift;;
21abc5b @klacke Initial revision
authored
106 -c)
961926f @klacke ""
authored
107 conf=" -conf $1 "
d5201c6 @klacke ""
authored
108 shift;;
767ff08 added -pa switch to the yaws start script
Tobbe Tornquist authored
109 -pa)
110 xpath=" ${xpath} -pa $1 "
111 shift;;
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored
112 -r)
113 runmod=" -runmod $1 "
114 shift;;
38fb85e @klacke ""
authored
115 -h)
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id suppo...
authored
116 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl hup";;
38fb85e @klacke ""
authored
117 -s)
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id suppo...
authored
118 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl stop";;
d659ba3 @klacke added a 'yaws -ls' command that lists all yaws servers on localhost
authored
119 -ls)
120 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl ls";;
6377222 @klacke ""
authored
121 -S)
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id suppo...
authored
122 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl status";;
caa1a72 @carsten3347 Added command `-load' to yaws script.
carsten3347 authored
123 -load)
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id suppo...
authored
124 $erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl load ${id} $*
caa1a72 @carsten3347 Added command `-load' to yaws script.
carsten3347 authored
125 exit 0;;
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id suppo...
authored
126 -j)
127 ex="$erl -noshell -pa ${yawsdir}${delim}ebin -s yaws_ctl trace $1"
128 shift;;
639b7c2 @klacke ""
authored
129 -v)
28e4c73 @klacke first attempt to run properly under cygwin
authored
130 exec $erl -noshell -pa ${yawsdir}${delim}ebin -s yaws printversion;
dcc3217 @klacke ""
authored
131 exit 0;;
ab3a6d0 Added the '-sname <Node>' switch to the yaws script
Tobbe Tornquist authored
132 -sname)
133 sname=" -sname $1 "
134 shift;;
4d59534 @klacke ""
authored
135 -name)
136 sname=" -name $1 "
137 shift;;
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
138 -heart)
139 heart=" -heart ";;
4d59534 @klacke ""
authored
140 -proto_dist)
141 pdist=" -proto_dist $1 "
142 shift;;
2f51c68 @klacke -check arg
authored
143 -check)
2eeee0d @klacke ""
authored
144 mkdir /tmp/yaws 2> /dev/null
145 mkdir /tmp/yaws/${ID} 2> /dev/null
6c84378 @klacke ""
authored
146 out=`exec $erl -noshell -pa ${yawsdir}${delim}ebin ${xpath} -s yaws_ctl check ${id} $*`
2f51c68 @klacke -check arg
authored
147 if [ "$out" = "ok" ]; then
12cb27f @klacke ""
authored
148 echo "$1" ok
2f51c68 @klacke -check arg
authored
149 exit 0
150 fi
151 echo $out
152 exit 1;;
21abc5b @klacke Initial revision
authored
153 *)
154 help
155 esac
156 done
157
dc00e52 @klacke postvar bug by hal snyder, added yaws_api:query_url/1 added the id suppo...
authored
158
159 if [ ! -z "${ex}" ]; then
160 exec ${ex} ${id}
161 exit 0
162 fi
163
164
82d6e29 @klacke added -x flag for tty trace and did the 1.3 release
authored
165 trace="${trace} ${traceoutput}"
166
38fb85e @klacke ""
authored
167 [ -z "$daemon" ] && [ -z "$interactive" ] && help
168
f22e6e8 Fixed heart bug
Johan Bevemyr authored
169 if [ -z "$heart" ] || [ -z "$daemon" ]; then
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
170 HEART_COMMAND="";
171 else
172 ## ............................this line
4d59534 @klacke ""
authored
173 export HEART_COMMAND="${ENV_PGM} HEART=true \"$erl\" ${daemon} ${heart} -pa ${yawsdir}${delim}ebin ${xpath} ${sname} ${pdist} ${debug} -s yaws $trace $conf $runmod $mnesia";
844fe5a Added support for the '-heart' switch.
Tobbe Tornquist authored
174 fi
175
176 ## keep this line in sync with ....^
4d59534 @klacke ""
authored
177 exec "$erl" ${daemon} ${heart} -pa ${yawsdir}${delim}ebin ${xpath} ${sname} ${pdist} ${debug} -s yaws $trace $conf $runmod $mnesia
22fd788 Added the '-r <Mod>' switch.
Tobbe Tornquist authored
178
21abc5b @klacke Initial revision
authored
179
Something went wrong with that request. Please try again.