Using
in serverjava.sh
started by
in serverjava.service
produces
The same hw.jar started manually
by executing h.sh containing:
gives positive response
Everything happens on centos-7-x86_64.
How to avoid this access deny that causes jetty HTTP error when system service starts? I have previously successfully run this with success on Ubuntu but have to change system due to Ubuntu stability issues.
I would be very thankful for any help.
B4X:
#!/bin/sh
SERVICE_NAME=serverjava
PATH_TO_JAR=/home/dd/hw.jar
PID_PATH_NAME=/tmp/serverjava-pid
case $1 in
start)
echo "Starting $SERVICE_NAME ..."
if [ ! -f $PID_PATH_NAME ]; then
nohup /home/dd/jre/bin/java -jar $PATH_TO_JAR /tmp 2>> /dev/null >>/dev/null &
echo $! > $PID_PATH_NAME
echo "$SERVICE_NAME started ..."
else
echo "$SERVICE_NAME is already running ..."
fi
in serverjava.sh
started by
B4X:
[Unit]
Description = Java Service
After network.target = serverjava.service
[Service]
Type = forking
Restart=always
RestartSec=1
User=dd
SuccessExitStatus=143
ExecStart = /usr/local/bin/serverjava.sh start
ExecStop = /usr/local/bin/serverjava.sh stop
ExecReload = /usr/local/bin/serverjava.sh reload
[Install]
WantedBy=multi-user.target
in serverjava.service
produces
HTTP ERROR 404
Problem accessing /FormExample.html. Reason:
Not Found
Powered by Jetty:// 9.4.z-SNAPSHOT
The same hw.jar started manually
by executing h.sh containing:
B4X:
#!/bin/sh
/home/dd/jre/bin/java -jar /home/dd/hw.jar
gives positive response
This is a static file, loaded from the www folder.
Examples:
Everything happens on centos-7-x86_64.
How to avoid this access deny that causes jetty HTTP error when system service starts? I have previously successfully run this with success on Ubuntu but have to change system due to Ubuntu stability issues.
I would be very thankful for any help.