Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- BASE_DIR=$(dirname "$(readlink -f $0)")
- CONFIG_FILE="$BASE_DIR/PtokaX.conf"
- . "$CONFIG_FILE"
- : ${PTOKAX_DIR:="$BASE_DIR"}
- : ${CONFIG_DIR:="$PTOKAX_DIR"}
- : ${LUA_PATH:="$CONFIG_DIR/scripts/?.lua;$CONFIG_DIR/scripts/libs/?.lua;$PTOKAX_DIR/libs/?.lua;$PTOKAX_DIR/scripts/?.lua;$PTOKAX_DIR/scripts/libs/?.lua;;"}
- : ${LUA_CPATH:="$CONFIG_DIR/scripts/?.so;$CONFIG_DIR/scripts/libs/?.so;$PTOKAX_DIR/libs/?.so;$PTOKAX_DIR/scripts/?.so;$PTOKAX_DIR/scripts/libs/?.so;;"}
- : ${PTOKAX:="$PTOKAX_DIR/PtokaX.bin"}
- : ${START_STOP_DAEMON:="$PTOKAX_DIR/start-stop-daemon"}
- start() {
- # Setup LUA search paths
- export LUA_PATH LUA_CPATH
- # Start PtokaX
- "$START_STOP_DAEMON" --start --oknodo --quiet --exec "$PTOKAX" -- \
- -d -c "$CONFIG_DIR" ${PTOKAX_USER:+-u "$PTOKAX_USER"}
- }
- stop() {
- "$START_STOP_DAEMON" --stop --oknodo --quiet --exec "$PTOKAX"
- }
- restart() {
- stop
- start
- }
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- restart
- ;;
- *)
- echo 'Usage: PtokaX [start|stop|restart]' >&2
- exit 1
- ;;
- esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement