From fe4275f4d4e01d1cd5a4cbed784c0a5810e06d0d Mon Sep 17 00:00:00 2001
From: j1nx
Date: Sat, 8 Oct 2022 20:37:08 +0200
Subject: [PATCH] Service changes
---
.../rootfs-overlay/home/mycroft/.bashrc | 2 +-
.../local-backend.service | 1 +
.../lib/systemd/system-preset/10-ovos.preset | 3 +--
.../lib/systemd/system/local-backend.service | 13 ------------
.../lib/systemd/user/local-backend.service | 20 +++++++++++++++++++
.../lib/systemd/user/mycroft-audio.service | 2 +-
.../user/mycroft-enclosure-gui.service | 2 +-
.../systemd/user/mycroft-messagebus.service | 2 +-
.../usr/lib/systemd/user/mycroft-phal.service | 2 +-
.../lib/systemd/user/mycroft-skills.service | 2 +-
.../lib/systemd/user/mycroft-voice.service | 2 +-
11 files changed, 29 insertions(+), 22 deletions(-)
create mode 120000 buildroot-external/rootfs-overlay/home/mycroft/.config/systemd/user/mycroft.service.wants/local-backend.service
delete mode 100644 buildroot-external/rootfs-overlay/usr/lib/systemd/system/local-backend.service
create mode 100644 buildroot-external/rootfs-overlay/usr/lib/systemd/user/local-backend.service
diff --git a/buildroot-external/rootfs-overlay/home/mycroft/.bashrc b/buildroot-external/rootfs-overlay/home/mycroft/.bashrc
index 7941fac0..83dc3527 100644
--- a/buildroot-external/rootfs-overlay/home/mycroft/.bashrc
+++ b/buildroot-external/rootfs-overlay/home/mycroft/.bashrc
@@ -5,4 +5,4 @@ alias ll='ls -la'
######################################################################
# Initialize OpenVoiceOS CLI Environment
######################################################################
-source cli_login.sh
+#source cli_login.sh
diff --git a/buildroot-external/rootfs-overlay/home/mycroft/.config/systemd/user/mycroft.service.wants/local-backend.service b/buildroot-external/rootfs-overlay/home/mycroft/.config/systemd/user/mycroft.service.wants/local-backend.service
new file mode 120000
index 00000000..48541d84
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/home/mycroft/.config/systemd/user/mycroft.service.wants/local-backend.service
@@ -0,0 +1 @@
+../../../../../../usr/lib/systemd/user/local-backend.service
\ No newline at end of file
diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system-preset/10-ovos.preset b/buildroot-external/rootfs-overlay/usr/lib/systemd/system-preset/10-ovos.preset
index 8b1fe952..a22a3648 100644
--- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system-preset/10-ovos.preset
+++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/system-preset/10-ovos.preset
@@ -9,9 +9,8 @@ enable NetworkManager.service
enable getty@tty1.service
enable ovos-splash-start.service
enable ovos-splash-systemd.service
-enable ovos-splash-quit.service
-enable local-backend.service
+disable ovos-splash-quit.service
disable mosquitto.service
disable motion.service
disable mpd.service
diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/local-backend.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/system/local-backend.service
deleted file mode 100644
index e627f677..00000000
--- a/buildroot-external/rootfs-overlay/usr/lib/systemd/system/local-backend.service
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description=OVOS Local Backend
-
-[Service]
-User=mycroft
-WorkingDirectory=/home/mycroft
-ExecStart=ovos-local-backend
-StandardOutput=file:/var/log/mycroft/local-backend.log
-StandardError=file:/var/log/mycroft/local-backend.error.log
-Restart=on-failure
-
-[Install]
-WantedBy=multi-user.target
diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/local-backend.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/local-backend.service
new file mode 100644
index 00000000..7faf2c44
--- /dev/null
+++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/local-backend.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=Mycroft Skills
+PartOf=mycroft.service
+After=mycroft.service
+After=mycroft-messagebus.service
+
+[Service]
+ExecStart=ovos-local-backend
+StandardOutput=append:/home/mycroft/.local/state/mycroft/local-backend.log
+#StandardError=file:/home/mycroft/.local/state/mycroft/local-backend.error.log
+TimeoutStartSec=10m
+TimeoutStopSec=1m
+Restart=on-failure
+StartLimitInterval=5min
+StartLimitBurst=4
+#StartLimitAction=reboot-force
+#WatchdogSec=30s
+
+[Install]
+WantedBy=mycroft.service
diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-audio.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-audio.service
index e7dd1a53..4ff2516d 100644
--- a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-audio.service
+++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-audio.service
@@ -8,7 +8,7 @@ After=mycroft-messagebus.service
Type=notify
ExecStart=/usr/libexec/mycroft-systemd-audio
StandardOutput=append:/home/mycroft/.local/state/mycroft/audio.log
-StandardError=file:/home/mycroft/.local/state/mycroft/audio.error.log
+#StandardError=file:/home/mycroft/.local/state/mycroft/audio.error.log
TimeoutStartSec=1m
TimeoutStopSec=1m
Restart=on-failure
diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-enclosure-gui.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-enclosure-gui.service
index 58cff1e0..27d83013 100644
--- a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-enclosure-gui.service
+++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-enclosure-gui.service
@@ -8,7 +8,7 @@ After=mycroft-messagebus.service
Type=notify
ExecStart=/usr/libexec/mycroft-systemd-gui
StandardOutput=append:/home/mycroft/.local/state/mycroft/enclosure_gui.log
-StandardError=file:/home/mycroft/.local/state/mycroft/enclosure_gui.error.log
+#StandardError=file:/home/mycroft/.local/state/mycroft/enclosure_gui.error.log
TimeoutStartSec=1m
TimeoutStopSec=1m
Restart=on-failure
diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-messagebus.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-messagebus.service
index 387c4d7b..8df782a5 100644
--- a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-messagebus.service
+++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-messagebus.service
@@ -7,7 +7,7 @@ After=mycroft.service
Type=notify
ExecStart=/usr/libexec/mycroft-systemd-messagebus
StandardOutput=append:/home/mycroft/.local/state/mycroft/bus.log
-StandardError=file:/home/mycroft/.local/state/mycroft/bus.error.log
+#StandardError=file:/home/mycroft/.local/state/mycroft/bus.error.log
TimeoutStartSec=1m
TimeoutStopSec=1m
Restart=on-failure
diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-phal.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-phal.service
index c5163f5c..e11ba2ee 100644
--- a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-phal.service
+++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-phal.service
@@ -8,7 +8,7 @@ After=mycroft-messagebus.service
Type=notify
ExecStart=/usr/libexec/mycroft-systemd-phal
StandardOutput=append:/home/mycroft/.local/state/mycroft/phal.log
-StandardError=file:/home/mycroft/.local/state/mycroft/phal.error.log
+#StandardError=file:/home/mycroft/.local/state/mycroft/phal.error.log
TimeoutStartSec=1m
TimeoutStopSec=1m
Restart=on-failure
diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-skills.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-skills.service
index ef4d3607..d8ee3306 100644
--- a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-skills.service
+++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-skills.service
@@ -8,7 +8,7 @@ After=mycroft-messagebus.service
Type=notify
ExecStart=/usr/libexec/mycroft-systemd-skills
StandardOutput=append:/home/mycroft/.local/state/mycroft/skills.log
-StandardError=file:/home/mycroft/.local/state/mycroft/skills.error.log
+#StandardError=file:/home/mycroft/.local/state/mycroft/skills.error.log
TimeoutStartSec=10m
TimeoutStopSec=1m
Restart=on-failure
diff --git a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-voice.service b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-voice.service
index 446b39c7..3f7138a8 100644
--- a/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-voice.service
+++ b/buildroot-external/rootfs-overlay/usr/lib/systemd/user/mycroft-voice.service
@@ -8,7 +8,7 @@ After=mycroft-messagebus.service
Type=notify
ExecStart=/usr/libexec/mycroft-systemd-voice
StandardOutput=append:/home/mycroft/.local/state/mycroft/voice.log
-StandardError=file:/home/mycroft/.local/state/mycroft/voice.error.log
+#StandardError=file:/home/mycroft/.local/state/mycroft/voice.error.log
TimeoutStartSec=1m
TimeoutStopSec=1m
Restart=on-failure