Mailing List Archive

Database not up yet
G'day,

I run my DB on a different machine that is slow to boot.

On a power outage my combo front/backend starts well before the DB is
available.

mythbackend is OK as it retries and I have added a test script/service
to check DB is up before starting.

Is there a simple way to start to frontend after the DB has started?

Currently the frontend is started by
~/.config/autostart/mythwelcome.desktop with
Exec=/usr/bin/mythwelcome --verbose general --loglevel info
I could add another script in there that calls mythwelcome after the DB
is up.

I could make mythwelcome start by systemd and then I could use the same
method as the backend.

Other options?

--
'ooroo

Stinga...(:)-)
---------------------------------------------------
Email:stinga+mythtv@wolf-rock.com o
You need only two tools. o /////
A hammer and duct tape. If it /@ `\ /) ~
doesn't move and it should use > (O) X< ~ Fish!!
the hammer. If it moves and `\___/' \) ~
shouldn't, use the tape. \\\
---------------------------------------------------
Re: Database not up yet [ In reply to ]
On Tue, 4 Apr 2023 14:16:54 +0800, you wrote:

>G'day,
>
>I run my DB on a different machine that is slow to boot.
>
>On a power outage my combo front/backend starts well before the DB is
>available.
>
>mythbackend is OK as it retries and I have added a test script/service
>to check DB is up before starting.
>
>Is there a simple way to start to frontend after the DB has started?
>
>Currently the frontend is started by
>~/.config/autostart/mythwelcome.desktop with
>Exec=/usr/bin/mythwelcome --verbose general --loglevel info
>I could add another script in there that calls mythwelcome after the DB
>is up.
>
>I could make mythwelcome start by systemd and then I could use the same
>method as the backend.
>
>Other options?

I think using a systemd user unit would be a good option, to run
mythwelcome after everything is ready, but still run it as the desktop
user. See "systemctl --user".

Here is a simple .service file I use to run a script after the desktop
user login:

stephen@mypvr:~$ systemctl --user cat startup
# /home/stephen/.config/systemd/user/startup.service
[Unit]
Description=JSW user startup
After=default.target

[Service]
ExecStart=/home/stephen/bin/jsw-user-startup.sh

[Install]
WantedBy=default.target

My jsw-user-startup.sh script does an "xset s off" command to prevent
the X screensaver from blanking the screen after it is not used for a
while.

In your case, you would probably need a systemd system service that
checks for the database being up and provides a service that other
services like the one above can wait on before starting, like I do
here to delay things that need local network access, such as
mythbackend:

root@mypvr:/etc/systemd/system# systemctl cat local-network-pingable
# /etc/systemd/system/local-network-pingable.service
[Unit]
Description=Wait for the local network to be pingable
After=network.target

[Service]
Type=simple
ExecStartPre=/bin/bash -c "/usr/local/bin/wait-until-pingable.py
switch.jsw.gen.nz 30"
ExecStart=/bin/true

[Install]
WantedBy=multi-user.target
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org