Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash -e
- ### BEGIN INIT INFO
- # Provides: joseki
- # Required-Start: $remote_fs $syslog
- # Required-Stop: $remote_fs $syslog
- # Default-Start: 2 3 4 5
- # Default-Stop: 0 1 6
- # Short-Description: Start daemon at boot time
- # Description: Enable service provided by daemon.
- ### END INIT INFO
- . /lib/lsb/init-functions
- export TDBROOT="/path/to/TDB-0.8.7"
- export JOSEKIROOT="/path/to/Joseki-3.4.2"
- export JENAROOT="/path/to/Jena-2.6.3"
- export PATH="$TDBROOT/bin:$JOSEKIROOT/bin:$PATH"
- export CLASSPATH=".:$JENAROOT/lib/*.jar:$TDBROOT/lib/*.jar:$JOSEKIROOT/lib/*.jar"
- SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
- DAEMON="bin/rdfserver"
- PIDFILE=/var/run/joseki.pid
- LOGFILE=/var/log/joseki.log
- sanity_checks() {
- # check pid doesn't exist.
- if [ -a $PIDFILE ]; then
- /bin/echo "ERROR: PID file $PIDFILE already exists."
- exit 1
- fi
- }
- #
- # main()
- #
- case "${1:-''}" in
- 'start')
- sanity_checks
- log_begin_msg "Starting Joseki rdf server..."
- cd $JOSEKIROOT
- $DAEMON &> $LOGFILE & echo $! > $PIDFILE
- log_end_msg $?
- ;;
- 'stop')
- log_begin_msg "Stopping Joseki rdf server..."
- start-stop-daemon --stop --pidfile $PIDFILE
- rm $PIDFILE
- log_end_msg $?
- ;;
- 'restart')
- $SELF stop
- $SELF start
- ;;
- *)
- /bin/echo "Usage: $SELF start|stop|restart"
- exit 1
- ;;
- esac
Add Comment
Please, Sign In to add comment