Permalink
Browse files

Added support for the '-heart' switch.

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@112 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent 08d72ff commit 844fe5ab8629e9723a4eff6403092f9189122a51 Tobbe Tornquist committed Jun 20, 2002
Showing with 18 additions and 1 deletion.
  1. +18 −1 scripts/yaws.ss
View
@@ -5,6 +5,9 @@ yawsdir=%yawsdir%
erl=%erl%
+ENV_PGM=`which env`
+
+
help()
{
echo "usage: server modes ... "
@@ -17,6 +20,9 @@ help()
echo " yaws -T -- trace http traffic"
echo " yaws -v -- print version"
echo ""
+ echo " yaws -heart -- auto restart yaws if it crashes"
+ echo " (requires the -D switch)"
+ echo ""
echo ""
echo "ctl functions ... "
echo " yaws -h -- hup the daemon "
@@ -33,6 +39,7 @@ trace="";
conf="";
runmod="";
sname="";
+heart="";
while [ $# -gt 0 ]
do
@@ -73,13 +80,23 @@ do
-sname)
sname=" -sname $1 "
shift;;
+ -heart)
+ heart=" -heart ";;
*)
help
esac
done
[ -z "$daemon" ] && [ -z "$interactive" ] && help
-exec $erl ${daemon} -pa ${yawsdir}/ebin ${sname} ${debug} -s yaws $trace $conf $runmod
+if [ -z "$heart" ] !! [ -z "$daemon" ]; then
+ HEART_COMMAND="";
+else
+ ## ............................this line
+ export HEART_COMMAND="${ENV_PGM} HEART=true $erl ${daemon} ${heart} -pa ${yawsdir}/ebin ${sname} ${debug} -s yaws $trace $conf $runmod";
+fi
+
+## keep this line in sync with ....^
+exec $erl ${daemon} ${heart} -pa ${yawsdir}/ebin ${sname} ${debug} -s yaws $trace $conf $runmod

0 comments on commit 844fe5a

Please sign in to comment.