packages feed

happs-tutorial-0.7: templates/starthappstackonboot.st

<h3>Start Happstack Automatically At Boot Time</h3>

<p>What happens if your Happstack deployment server experiences a power outage?</p>

<p>The way I deal with this issue with a public-facing Happstack application is to have a cron job that runs every minute, that will start the happs application if it isn't running.</p>

<p>
  thartman@thartman-laptop:~/happs-tutorial>crontab -l
<br>* * * * *   /home/thartman/happs-tutorial/happs-tutorial.cron.sh
<br>
<br>thartman@thartman-laptop:~/happs-tutorial>cat happs-tutorial.cron.sh
<br># this is a workaround to a problem that my happs app dies for reasons described at
<br># http://code.google.com/p/happs/issues/detail?id=40
<br># generate the executable first by running runServer.sh
<br># then add this file to your crontab so you have something like
<br># thartman@thartman-laptop:~>crontab -l
<br># * * * * *   /home/thartman/happs-tutorial/happs-tutorial.cron.sh
<br>
<br>if [ -z "`pgrep happs-tutorial`" ];
<br>  then cd ~/happs-tutorial
<br>          ./happs-tutorial >happs-tutorial.cron.out 2>happs-tutorial.cron.err
<br>fi
</p>