touch /usr/lib/systemd/system/jboss.service
[Unit]
Description=JBoss 4.0 App Server
[Service]
Type=simple
User=root
Group=root
ExecStart=/opt/jboss/bin/run.sh
ExecStop=/opt/jboss/bin/shutdown.sh
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable jboss.service
systemctl start jboss.service
Обычный init script(плохой вариант для systemd):
#! /bin/sh
start(){
echo "Starting jboss.."
# su -l jboss -c '/opt/jboss/current/bin/run.sh > /dev/null 2> /dev/null &'
/opt/jboss/bin/run.sh > /dev/null 2> /dev/null &
}
stop(){
echo "Stopping jboss.."
# su -l jboss -c '/opt/jboss/current/bin/shutdown.sh -S &'
/opt/jboss/bin/shutdown.sh -S &
}
restart(){
stop
sleep 60
killall java
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: jboss {start|stop|restart}"
exit 1
esac
exit 0
Читать далее
5 лет назад