Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/sh
- # Author: deseven, <de7@deseven.info>
- #
- # chkconfig: 2345 98 02
- # description: l2j game server
- # processname: java
- # Source function library.
- . /etc/rc.d/init.d/functions
- # Source networking configuration.
- . /etc/sysconfig/network
- # Name of service
- SERVICE="l2g"
- # Main gs invocation
- INVOC="java -Xbootclasspath/p:./lib/jsr167.jar -javaagent:lib/updater.jar=off -Dfile.encoding=UTF-8 -Xms2048m -Xmx5G -server -XX:SurvivorRatio=8 -Xnoclassgc -XX:+AggressiveOpts -cp lib/*: com.emurt.gameserver.util.BootManager"
- # Name of gs session
- SESS="game"
- # User that should run the server
- USERNAME="srv"
- # Path to gs directory
- GSPATH="/home/srv/l2/emurt-game"
- # Path to PID-file
- PIDPATH="/home/srv/l2/emurt-game/config/server.pid"
- RETVAL=0
- srv_start() {
- echo -n "Starting $SERVICE:"
- daemon screen -dmS $SESS "su $USERNAME -c 'cd $GSPATH && $INVOC'"
- RETVAL=$?
- echo
- [ $RETVAL = 0 ] && touch /var/lock/subsys/$SERVICE
- }
- srv_stop() {
- echo -n "Stopping $SERVICE:"
- killproc -p $PIDPATH
- RETVAL=$?
- echo
- [ $RETVAL = 0 ] && rm -f /var/lock/subsys/$SERVICE
- }
- case "$1" in
- start)
- # Starts the server if there is active interface
- [ "$NETWORKING" = "yes" ] || exit 6
- srv_start
- ;;
- stop)
- # Stops the server
- srv_stop
- ;;
- restart)
- # Restarts the server
- srv_stop
- srv_start
- ;;
- status)
- # Shows server status
- status -p $PIDPATH $SERVICE
- RETVAL=$?
- ;;
- sess)
- # Shows current screen session
- screen -x $SESS
- RETVAL=$?
- ;;
- *)
- echo "Usage: $0 {start|stop|status|restart|sess}"
- exit 1
- ;;
- esac
- exit $RETVAL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement