Start JBoss 7 as a service on Linux

后端 未结 12 1996
闹比i
闹比i 2020-12-12 11:54

Previous versions of JBoss included a scripts (like jboss_init_redhat.sh) that could be copied to /etc/init.d in order to add it as a service - so it would star

12条回答
  •  轮回少年
    2020-12-12 12:39

    #! /bin/sh
    
    start(){
        echo "Starting JBoss 7"
        sudo -u jboss sh /usr/local/jboss/bin/standalone.sh
    }
    
    stop(){
        echo "Stopping JBoss 7"
        sudo -u jboss sh /usr/local/jboss/bin/jboss-admin.sh --connect command=:shutdown
    }
    
    restart(){
        stop
        # give stuff some time to stop before we restart
        sleep 60
        # protect against any services that can't stop before we restart 
        su -l jboss -c 'killall java'
        start
    }
    
    case "$1" in
        start)
            start
        ;;
        stop)
            stop
        ;;
        restart)
            restart
        ;;
        *)
            echo "Usage: jboss {start|stop|restart}"
            exit 1
        ;;
    esac
    
    exit 0
    

提交回复
热议问题