Start H2 Db as daemon

Here my script to start H2 db as daemon under linux Os.
Please note param “-baseDir $HOME” this means that default storage path is the home of the user that start db,
change variable with absolute path to prevent new Db creation with wrong users.

 
#!/bin/sh

cd `dirname ${0}`/..

case $1 in
  help)
    java -cp <h2Path>/h2-*.jar org.h2.tools.Server -?
  ;;

  start)
    java -cp <h2Path>/h2-*.jar org.h2.tools.Server -tcp -web -baseDir $HOME &
  ;;

  stop)
    java -cp <h2Path>/h2-*.jar org.h2.tools.Server -tcpShutdown "tcp://localhost"
  ;;

  *)
    echo "Usage ${0} (help|start|stop)"
  ;;
esac

Leave a Reply

Your email address will not be published. Required fields are marked *

Antispam Question * Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.