Advertisement
Guest User

Untitled

a guest
Dec 17th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. BASE_DIR=$(dirname "$(readlink -f $0)")
  4. CONFIG_FILE="$BASE_DIR/PtokaX.conf"
  5.  
  6. . "$CONFIG_FILE"
  7.  
  8. : ${PTOKAX_DIR:="$BASE_DIR"}
  9. : ${CONFIG_DIR:="$PTOKAX_DIR"}
  10.  
  11. : ${LUA_PATH:="$CONFIG_DIR/scripts/?.lua;$CONFIG_DIR/scripts/libs/?.lua;$PTOKAX_DIR/libs/?.lua;$PTOKAX_DIR/scripts/?.lua;$PTOKAX_DIR/scripts/libs/?.lua;;"}
  12. : ${LUA_CPATH:="$CONFIG_DIR/scripts/?.so;$CONFIG_DIR/scripts/libs/?.so;$PTOKAX_DIR/libs/?.so;$PTOKAX_DIR/scripts/?.so;$PTOKAX_DIR/scripts/libs/?.so;;"}
  13.  
  14. : ${PTOKAX:="$PTOKAX_DIR/PtokaX.bin"}
  15. : ${START_STOP_DAEMON:="$PTOKAX_DIR/start-stop-daemon"}
  16.  
  17. start() {
  18. # Setup LUA search paths
  19. export LUA_PATH LUA_CPATH
  20.  
  21. # Start PtokaX
  22. "$START_STOP_DAEMON" --start --oknodo --quiet --exec "$PTOKAX" -- \
  23. -d -c "$CONFIG_DIR" ${PTOKAX_USER:+-u "$PTOKAX_USER"}
  24. }
  25.  
  26. stop() {
  27. "$START_STOP_DAEMON" --stop --oknodo --quiet --exec "$PTOKAX"
  28. }
  29.  
  30. restart() {
  31. stop
  32. start
  33. }
  34.  
  35. case "$1" in
  36. start)
  37. start
  38. ;;
  39. stop)
  40. stop
  41. ;;
  42. restart)
  43. restart
  44. ;;
  45. *)
  46. echo 'Usage: PtokaX [start|stop|restart]' >&2
  47. exit 1
  48. ;;
  49. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement