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 login server
- # processname: java
- # Source function library.
- . /etc/rc.d/init.d/functions
- # Source networking configuration.
- . /etc/sysconfig/network
- # Name of service
- SERVICE="l2l"
- # Main ls invocation
- INVOC="java -Xbootclasspath/p:./lib/jsr167.jar -Dfile.encoding=UTF-8 -Xmx256m -server -XX:SurvivorRatio=8 -Xnoclassgc -XX:+AggressiveOpts -cp lib/*: com.emurt.loginserver.LoginServer"
- # Name of ls session
- SESS="login"
- # User that should run the server
- USERNAME="srv"
- # Path to ls directory
- LSPATH="/home/srv/l2/emurt-login"
- # Path to PID-file
- PIDPATH="/home/srv/l2/emurt-login/config/server.pid"
- RETVAL=0
- srv_start() {
- echo -n "Starting $SERVICE:"
- daemon screen -dmS $SESS "su $USERNAME -c 'cd $LSPATH && $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