1. happs intro
  2. the missing happs documentation
  3. getting started with happs
  4. prerequisites
  5. cabal install me
  6. main
  7. url handling
  8. templates
  9. stringtemplate basics
  10. debugging
  11. form data: get and post
  12. form data: file uploads
  13. cookies
  14. introduction to macid
  15. using macid safely
  16. macid dummy data
  17. macid updates and queries
  18. changing the data model
  19. macid stress test
  20. limitations of macid
  21. foreign characters
  22. cron jobs
  23. thanks
  24. appendix (floundering in ghci)

Start HAppS Automatically At Boot Time

What happens if your HAppS deployment server experiences a power outage?

Or what if the HAppS process just dies for mysterious reasons?

The way I deal with this both these issues with a public-facing happs application is to have a cron job that runs every minute, that will start the happs application if it isn't running.

thartman@thartman-laptop:~/happs-tutorial>crontab -l
* * * * * /home/thartman/happs-tutorial/happs-tutorial.cron.sh

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

if [ -z "`pgrep happs-tutorial`" ];
then cd ~/happs-tutorial
./happs-tutorial >happs-tutorial.cron.out 2>happs-tutorial.cron.err
fi