Artemis 版本:2.19.1
JDK 1.8.0.271
尝试过使用不同权限用户,都无法使用 systemctl start 启动
使用 broker 中的 artemis-service start ,能够正常启动
service 文件如下
[Unit]
Description=Apache ActiveMQ Artemis
After=network.target
[Service]
Type=forking
User=activemq
Group=activemq
ExecStart=/var/lib/jms-broker/bin/artemis-service start
ExecStop=/var/lib/jms-broker/bin/artemis-service stop
[Install]
WantedBy=multi-user.target
journalctl -xe
中的 artemis-service 返回的信息很有限,除了 starting ,就只有Could not start ${service}
顺便贴一下 artemis-serive 启动脚本的内容,这个脚本是 artemis 自动生成的
service=`basename "$0"`
#
# Discover the ARTEMIS_INSTANCE from the location of this script.
#
if [ -z "$ARTEMIS_INSTANCE" ] ; then
## resolve links - $0 may be a link to ActiveMQ's home
PRG="$0"
saveddir=`pwd`
# need this for relative symlinks
dirname_prg=`dirname "$PRG"`
cd "$dirname_prg"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
ARTEMIS_INSTANCE=`dirname "$PRG"`
cd "$saveddir"
# make it fully qualified
ARTEMIS_INSTANCE=`cd "$ARTEMIS_INSTANCE/.." && pwd`
export ARTEMIS_INSTANCE
fi
PID_FILE="${ARTEMIS_INSTANCE}/data/artemis.pid"
if [ ! -d "${ARTEMIS_INSTANCE}/data/" ]; then
mkdir "${ARTEMIS_INSTANCE}/data/"
fi
status() {
if [ -f "${PID_FILE}" ] ; then
pid=`cat "${PID_FILE}"`
# check to see if it's gone...
ps -p ${pid} > /dev/null
if [ $? -eq 0 ] ; then
return 0
else
rm "${PID_FILE}"
return 3
fi
fi
return 3
}
stop() {
if [ -f "${PID_FILE}" ] ; then
pid=`cat "${PID_FILE}"`
kill $@ ${pid} > /dev/null
fi
for i in 1 2 3 4 5 ; do
status
if [ $? -ne 0 ] ; then
return 0
fi
sleep 1
done
echo "Could not stop process ${pid}"
return 1
}
start() {
status
if [ $? -eq 0 ] ; then
echo "Already running."
return 1
fi
if [ -z "$ARTEMIS_USER" -o `id -un` = "$ARTEMIS_USER" ] ; then
nohup "${ARTEMIS_INSTANCE}/bin/artemis" run > /dev/null 2> /dev/null &
else
sudo -n -u ${ARTEMIS_USER} nohup "${ARTEMIS_INSTANCE}/bin/artemis" run > /dev/null 2> /dev/null &
fi
echo $! > "${PID_FILE}"
# check to see if stays up...
sleep 1
status
if [ $? -ne 0 ] ; then
echo "Could not start ${service}"
return 1
fi
echo "${service} is now running (${pid})"
return 0
}
case $1 in
start)
echo "Starting ${service}"
start
exit $?
;;
force-stop)
echo "Forcibly Stopping ${service}"
stop -9
exit $?
;;
stop)
echo "Gracefully Stopping ${service}"
stop
exit $?
;;
restart)
echo "Restarting ${service}"
stop
start
exit $?
;;
status)
status
rc=$?
if [ $rc -eq 0 ] ; then
echo "${service} is running (${pid})"
else
echo "${service} is stopped"
fi
exit $rc
;;
*)
echo "Usage: $0 {start|stop|restart|force-stop|status}" >&2
exit 2
;;
esac
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.