Page 1 of 1

SOLVED Ubuntu 20.04 - OKM 6.3.0 - Tomcat/OpenKM Service Issues

PostPosted:Tue Jul 13, 2021 6:52 pm
by alexwgordon
Hi All,

It's been a while since I've had to do any development on our OpenKM instance and have run into a few snags as we're migrating the whole system from a Windows Server 2008 machine to a Ubuntu 20.04 VM on a Synology.

So far I've successfully setup and gotten a working instance of OKM 6.3.0 (what was originally on our Windows 2008 setup--I may upgrade it later, but for smoother transition I'll leave it for now) without any of our original data, but most of our customizations including our approval workflow--which is great.

One of my remaining issues is that I can't seem to get a working service for Tomcat following this link: https://www.openkm.com/wiki/index.php/C ... vice_linux

When I check systemctl I see this
Code: Select all
tomcat.service      loaded  active exited    LSB: Start and stop Apache Tomcat
And when the command below is run, I don't get any ECHO.
Code: Select all
sudo service tomcat start
I do have Ubuntu user named openkm, which I've seen others having issues with.

I've installed OpenKM using this method: https://www.unixmen.com/install-openkm- ... ntu-15-04/ so my openkm instance is installed at /opt/openkm-6.3.0-community/ which has been altered in my tomcat.service file as shown below:
Code: Select all
TOMCAT_HOME=/opt/openkm-6.3.0-community/tomcat
Any advice/help would be greatly appreciated! Please let me know if there are any other logs, etc that I should post. Thanks!

Re: Ubuntu 20.04 - OKM 6.3.0 - Tomcat/OpenKM Service Issues

PostPosted:Sun Jul 18, 2021 10:34 am
by jllort
Wiki documentation is totally deprecated you should use https://docs.openkm.com/kcenter/view/ok ... ebian.html

Re: Ubuntu 20.04 - OKM 6.3.0 - Tomcat/OpenKM Service Issues

PostPosted:Mon Jul 19, 2021 2:29 pm
by alexwgordon
Thanks for the reply jllort!

I've attempted using that documentation as well (previously and just not to be certain), but am unable to get a systemctl status other than
Code: Select all
tomcat.service      loaded  active exited    LSB: Start and stop Apache Tomcat
I'm doing the below (as stated in the docs you just linked):
Code: Select all
sudo vim /etc/init.d/tomcat
Adding the code to the file:
Code: Select all
#!/bin/sh
 
### BEGIN INIT INFO
# Provides:          tomcat
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start and stop Apache Tomcat
# Description:       Enable Apache Tomcat service provided by daemon.
### END INIT INFO
 
ECHO=/bin/echo
TEST=/usr/bin/test
TOMCAT_USER=openkm
TOMCAT_HOME=/opt/openkm-6.3.0-community/tomcat
TOMCAT_START_SCRIPT=$TOMCAT_HOME/bin/startup.sh
TOMCAT_STOP_SCRIPT=$TOMCAT_HOME/bin/shutdown.sh
 
$TEST -x $TOMCAT_START_SCRIPT || exit 0
$TEST -x $TOMCAT_STOP_SCRIPT || exit 0
 
start() {
    $ECHO -n "Starting Tomcat"
    su - $TOMCAT_USER -c "$TOMCAT_START_SCRIPT &"
    $ECHO "."
}
 
stop() {
    $ECHO -n "Stopping Tomcat"
    su - $TOMCAT_USER -c "$TOMCAT_STOP_SCRIPT 60 -force &"
    while [ "$(ps -fu $TOMCAT_USER | grep java | grep tomcat | wc -l)" -gt "0" ]; do
        sleep 5; $ECHO -n "."
    done
    $ECHO "."
}
 
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        sleep 30
        start
        ;;
    *)
        $ECHO "Usage: tomcat {start|stop|restart}"
        exit 1
esac
exit 0
Then
Code: Select all
sudo chmod 755 /etc/init.d/tomcat
sudo update-rc.d tomcat defaults
sudo service tomcat start
Then checking with
Code: Select all
systemctl status tomcat
And getting:
Code: Select all
● tomcat.service - LSB: Start and stop Apache Tomcat
     Loaded: loaded (/etc/init.d/tomcat; generated)
     Active: active (exited) since Mon 2021-07-19 08:22:04 PDT; 57s ago
       Docs: man:systemd-sysv-generator(8)
      Tasks: 0 (limit: 2313)
     Memory: 0B
     CGroup: /system.slice/tomcat.service

Jul 19 08:22:03 openkm-stratedigm systemd[1]: Starting LSB: Start and stop Apache Tomcat...
Jul 19 08:22:03 openkm-stratedigm su[26414]: (to openkm) root on none
Jul 19 08:22:03 openkm-stratedigm su[26414]: pam_unix(su-l:session): session opened for user openkm by (uid=0)
Jul 19 08:22:04 openkm-stratedigm su[26414]: pam_unix(su-l:session): session closed for user openkm
Jul 19 08:22:04 openkm-stratedigm tomcat[26413]: Starting Tomcat
Jul 19 08:22:04 openkm-stratedigm tomcat[26428]: .
Jul 19 08:22:04 openkm-stratedigm systemd[1]: Started LSB: Start and stop Apache Tomcat.
Howver, I don't see anything happening in the catalina.log file showing that it attempted to start.

Does the openkm user need any specific permissions? Otherwise, if the code is OK, I'm not quite sure what else to check. Thanks so much in advance!

Re: Ubuntu 20.04 - OKM 6.3.0 - Tomcat/OpenKM Service Issues

PostPosted:Mon Jul 19, 2021 5:44 pm
by alexwgordon
Okay, it's not immediately clear why it's working or not working to me, but it is working now. I have openkm user set as a normal user (no admin privileges). I had restarted my virtual machine (which I thought I had previously done) but the service started up as it should.

So looks like the wiki docs works as it should. Maybe just restart everything after :shrug: