Closed thijsvdc closed 3 years ago
I don't have a system to test this but I think essentially you are doing the right thing:
$ sudo ln -s /path/to/PilotLog-2.0.0.jar /etc/init.d/pilotlog
Where I suspect it fails is that it tries to create the database file and logs in ~/.h2 and it can't do that for your root account.
Are you able to build the JAR with the Gradle wrapper using "./gradlew bootJar"? I could suggest a simple change to application.yml that might get it going.
The .h2 folder is correctly created:
ls -la .h2/
total 60
drwxr-xr-x 3 root root 4096 Mar 3 09:51 .
drwx------ 5 root root 4096 Mar 3 10:22 ..
drwxr-xr-x 2 root root 4096 Mar 3 09:51 logs
-rw-r--r-- 1 root root 45056 Mar 3 09:57 pilotlog.mv.db
I was able to install gradle, but I'm not sure about the exact on steps to build the JAR using Gradle. Anyway, I'll first need to be able to run the PilotLog-2.0.0.jar (see #9)
If you have Gradle installed, you can run the application using "gradle bootRun". To build the JAR file (which is in build/libs, use "gradle bootJar"). This is the executable JAR file that is provided as the release.
Now that PilotLog-2.0.0 starts manually, I'd like to run is as a daemon, but this still fails (same as 1.1.0):
# ln -s /root/PilotLog-2.0.0.jar /etc/init.d/pilotlog
# service pilotlog start
Failed to start pilotlog.service: Unit pilotlog.service not found.
The database is OK (~/.h2 dir and files created), so what else can I try?
Found it, works fine using systemd. Just create the file "/etc/systemd/system/pilotlog.service" and enter something like this:
[Unit]
Description=Pilotlog
After=syslog.target
[Service]
User=root
ExecStart=/root/PilotLog-2.0.0.jar SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
Enable and start the service:
systemctl enable pilotlog
systemctl start pilotlog
systemctl status pilotlog
* pilotlog.service - Pilotlog
Loaded: loaded (/etc/systemd/system/pilotlog.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-03-03 15:10:32 UTC; 2min 52s ago
Main PID: 97 (PilotLog-2.0.0.)
Tasks: 33 (limit: 4915)
Memory: 269.4M
CGroup: /system.slice/pilotlog.service
|- 97 /bin/bash /root/PilotLog-2.0.0.jar SuccessExitStatus=143
`-152 /usr/bin/java -Dsun.misc.URLClassPath.disableJarChecking=true -jar /root/PilotLog-2.0.0.jar SuccessExitStatus=143
Good work! Using systemd is preferred anyway is it not?
I did notice some Spring profile configuration errors but I don't think they will affect you. The profiles are only needed for development and running unit tests. I'll clear them up and push out a 2.0.1 at some stage.
Thanks. I'll be testing PilotLog tonight! I'll close this issue now
Versions
Please complete all of the following:
PilotLog version : 1.1.0 Java version : OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_282-b08) Flightgear version : n/a O/S : Debian O/S version : 10 Browser : n/a Browser version : n/a
Problem Description
Hi,
The PilotLog-1.1.0.jar runs fine on my Debian system. Since this is a remote system to my FG, I want to run it as a daemon. Reading the Sping Boot doc, I can't figure out how to do this exactly. Am I just supposed to "ln -s /path/to/my/PilotLog-1.1.0.jar /etc/init.d/pilotlo"? This gives:
service PilotLog start Failed to start PilotLog.service: Unit PilotLog.service not found.
"/var/run/pilotlog/pilotlog.pid" and "/var/log/pilotlog.log" do not exist.