Linux Service

From Obsidian Scheduler
Revision as of 18:16, 29 October 2026 by Craig (talk | contribs) (Wiki update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

As of Obsidian 7.1.0, on Linux an Embedded Tomcat pack and/or Standalone Runtime can install systemd templates -- see Linux desktop and systemd integration for the installer option and the manual linux/install-embedded-linux-integration.sh script. Installing those files does not enable or start anything.

Embedded Tomcat

systemctl --user enable --now [email protected]

For Standalone Admin embed installs:

systemctl --user enable --now [email protected]

The unit runs webObsidian.sh run with the instance name as the profile (scheduler or adminOnly) in the foreground (Type=simple, TimeoutStopSec=180). ./webObsidian.sh stop also stops a service-started instance. Do not run ./webObsidian.sh start scheduler by hand while the service is running.

Default HTTP 8080 and stop port 9597. Edit webObsidian.sh before enabling the service.

This embed unit is a user service. See Running without an active login session below.

Standalone Runtime

The standalone template is obsidian-standalone@. Instances:

  • @prod (or any name other than 1 / 2) runs standaloneObsidian.sh
  • @1 runs 1standaloneObsidian.sh when that script is present
  • @2 runs 2standaloneObsidian.sh when that script is present

User-level:

systemctl --user enable --now [email protected]

After a root / sudo install:

sudo systemctl enable --now [email protected]

The system template runs /etc/obsidian/standalone-instance.sh and looks up the install directory for that instance in /etc/obsidian/standalone-instances so more than one install can share the same template. A user-level unit instead runs linux/standalone-instance.sh from that install directory.

Either path stays in the foreground (Type=simple, TimeoutStopSec=180 unless the headless embed.linux.standalone.timeoutStopSec override is set) and calls standaloneObsidian.sh run (no background &). Stock standalone listen port is 10451 unless you change the launcher script. Stop with systemctl stop on the instance (see Stop and logs).

Stop and logs

Prefer systemctl stop on the instance. That runs the wrapper (linux/standalone-instance.sh stop or, for a system unit, /etc/obsidian/standalone-instance.sh stop), which writes linux/log4j2-%i.xml with literal log paths and sets log4j.configurationFile before the launcher stop. As of Obsidian 7.1.0, when log.path is outside the install directory the default standalone file is $INSTALL_PATH/logs/obsidian-standalone.log. Additional instances use obsidian-standalone-%i.log under that same logs/ directory.

Do not call ./standaloneObsidian.sh start (or the numbered 1/2 scripts) while the service is running. Do not stop with a launcher that never sets log4j.configurationFile -- Log4j then follows the classpath log4j2.xml and can open the Tomcat web log (permission denied as the scheduler user). Journal lines Null object returned for RollingFile or missing appender fileLogger mean the instance XML was not applied; leave the unit up if it is active and copy a current standalone-instance.sh plus log4j2-standalone.xml.template into linux/ (and /etc/obsidian/ for a system unit), then systemctl restart that instance.

Replacing a previous systemd unit

If you already run standalone under your own unit (especially Restart=always), stop and disable that unit before enabling obsidian-standalone@. Otherwise the old unit respawns the JVM on the same port.

systemctl mask only works when systemd can replace the unit path with a symlink to /dev/null. If a real unit file already lives at that path, mask fails with File exists. disable the unit, move or remove the file, then daemon-reload.

Running without an active login session

systemctl --user units (a GUI install, or a non-root enable) stop at logout and do not start at boot until lingering is on:

loginctl enable-linger <username>

A standalone template installed as root (typical headless sudo) is a system unit. It does not need linger. Use sudo systemctl (no --user).

Removing the integration

systemctl --user disable --now [email protected]
systemctl --user disable --now [email protected]
rm ~/.config/systemd/user/[email protected]
rm ~/.config/systemd/user/[email protected]
rm ~/.local/share/applications/obsidian-embedded.desktop
systemctl --user daemon-reload

For a system standalone template (root / sudo install):

sudo systemctl disable --now [email protected]
sudo rm /etc/systemd/system/[email protected]
sudo systemctl daemon-reload

The same details ship as linux/README-linux-integration.md in your install directory.