Guest User

Untitled

a guest
Jun 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. #!/bin/bash -e
  2.  
  3.  
  4. ### BEGIN INIT INFO
  5.  
  6. # Provides: joseki
  7. # Required-Start: $remote_fs $syslog
  8. # Required-Stop: $remote_fs $syslog
  9. # Default-Start: 2 3 4 5
  10. # Default-Stop: 0 1 6
  11. # Short-Description: Start daemon at boot time
  12. # Description: Enable service provided by daemon.
  13.  
  14. ### END INIT INFO
  15.  
  16. . /lib/lsb/init-functions
  17.  
  18. export TDBROOT="/path/to/TDB-0.8.7"
  19. export JOSEKIROOT="/path/to/Joseki-3.4.2"
  20. export JENAROOT="/path/to/Jena-2.6.3"
  21. export PATH="$TDBROOT/bin:$JOSEKIROOT/bin:$PATH"
  22. export CLASSPATH=".:$JENAROOT/lib/*.jar:$TDBROOT/lib/*.jar:$JOSEKIROOT/lib/*.jar"
  23.  
  24. SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
  25. DAEMON="bin/rdfserver"
  26. PIDFILE=/var/run/joseki.pid
  27. LOGFILE=/var/log/joseki.log
  28.  
  29. sanity_checks() {
  30. # check pid doesn't exist.
  31. if [ -a $PIDFILE ]; then
  32. /bin/echo "ERROR: PID file $PIDFILE already exists."
  33. exit 1
  34. fi
  35. }
  36.  
  37. #
  38. # main()
  39. #
  40.  
  41. case "${1:-''}" in
  42. 'start')
  43. sanity_checks
  44. log_begin_msg "Starting Joseki rdf server..."
  45. cd $JOSEKIROOT
  46. $DAEMON &> $LOGFILE & echo $! > $PIDFILE
  47. log_end_msg $?
  48. ;;
  49.  
  50. 'stop')
  51. log_begin_msg "Stopping Joseki rdf server..."
  52. start-stop-daemon --stop --pidfile $PIDFILE
  53. rm $PIDFILE
  54. log_end_msg $?
  55. ;;
  56.  
  57. 'restart')
  58. $SELF stop
  59. $SELF start
  60. ;;
  61.  
  62. *)
  63.  
  64. /bin/echo "Usage: $SELF start|stop|restart"
  65. exit 1
  66. ;;
  67. esac
Add Comment
Please, Sign In to add comment