Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 9 of 9
  1. #1
    Senior Member
    Join Date
    Jan 2011
    Location
    Staffordshire. UK
    Posts
    4,743

    Raspberry Pi & LMS - way to postpone start-up?

    Asking for a friend

    Am running LMS on Raspberry Pi 4 Raspian OS, whenever I start it up, the date/time showing on the SqueezeBox Touch is the time when the LMS was shutdown, its as though the LMS service is starting before the Pi has synced its time. Is it possible to delay starting up the LMS until the time is synced?

    Currently having to restart the LSM via 'Material' URL in order for the correct time to show.

    The Squeezebox touch and NAS are left on, the Pi is powered on as needed (via remotely activated socket) and then shutdown/powered off when not in use
    The pi syncs its time at start up.

    The problem can be solved by using a restart LMS bash script at boot (either by cronjob or autostart).

    The Touch can be restarted by a short press of the reset button on the back (not in favour).

    I have found a script, here on the forum, which claims to run on the pi and restart the Touch when the pi boots. This is not tested yet, as he is happy with a cronjob (who wouldn't be? )


    Do the panel think there is any other way to solve the problem

    Thanks

    ronnie

  2. #2
    Senior Member
    Join Date
    Jun 2017
    Posts
    534
    Quote Originally Posted by Man in a van View Post
    Asking for a friend

    ...

    Do the panel think there is any other way to solve the problem

    Thanks

    ronnie
    Since the Touch and the NAS are left on all the time, why not leave the Pi on, too?
    LMS 8 nightly running on Raspberry Pi OS. Mostly virtual players, occasionally with SB Radio, Boom or Classic.

  3. #3
    Senior Member
    Join Date
    Jan 2010
    Location
    Hertfordshire
    Posts
    7,976
    Quote Originally Posted by Man in a van View Post
    Asking for a friend



    The pi syncs its time at start up.

    The problem can be solved by using a restart LMS bash script at boot (either by cronjob or autostart).

    The Touch can be restarted by a short press of the reset button on the back (not in favour).

    I have found a script, here on the forum, which claims to run on the pi and restart the Touch when the pi boots. This is not tested yet, as he is happy with a cronjob (who wouldn't be? )


    Do the panel think there is any other way to solve the problem

    Thanks

    ronnie
    In raspi-config you can "wait for network on boot" or similar. Would that help?

    Sent from my Pixel 3a using Tapatalk

  4. #4
    Senior Member
    Join Date
    Jan 2011
    Location
    Staffordshire. UK
    Posts
    4,743
    Quote Originally Posted by RobbH View Post
    Since the Touch and the NAS are left on all the time, why not leave the Pi on, too?
    Quote Originally Posted by slartibartfast View Post
    In raspi-config you can "wait for network on boot" or similar. Would that help?

    Sorry that I did not give a more expansive thread opener, I was a bit pushed for time.

    The person uses the raspberry pi Buster Desktop OS with LMS v 8.2.1

    pCP was rejected, Network wait is enabled, and as stated in the opening post, it is desired to power down the pi in between usage.

    I have mirrored the set-up using a rpi3B+ instead of a rpi4b.

    Both a cronjob, and an autostart command, utilising a 25 sec sleep, restart the LMS successfully.

    I have thought about making a restart.service file but the cronjob seems to work OK for him at the moment

    I just though I would ask here, incase there is an alternative

    ronnie

  5. #5
    Senior Member
    Join Date
    May 2010
    Location
    London, UK
    Posts
    923
    Quote Originally Posted by Man in a van View Post
    Do the panel think there is any other way to solve the problem
    How to start service after system time has been synchronized:

    https://sleeplessbeastie.eu/2020/03/...-synchronized/

    I've not tried it.
    Last edited by mrw; 2021-10-13 at 09:39. Reason: type

  6. #6
    Senior Member
    Join Date
    Jan 2011
    Location
    Staffordshire. UK
    Posts
    4,743
    Quote Originally Posted by mrw View Post
    How to start service after system time has been synchronized:

    https://sleeplessbeastie.eu/2020/03/...-synchronized/

    I've not tried it.

    Thanks, that should make my head ache

    I'll try tomorrow

    ronnie

  7. #7
    Senior Member
    Join Date
    May 2010
    Location
    London, UK
    Posts
    923
    Quote Originally Posted by Man in a van View Post
    Thanks, that should make my head ache
    As I understand it:

    Enable the systemd-time-wait-sync service.

    Code:
    sudo systemctl enable systemd-time-wait-sync
    Drop an appropriate systemd snippet under the LMS service, easy way:

    Code:
    sudo systemctl edit logitechmediaserver.service
    
    Text needed:
    
    [Unit]
    After=time-sync.target
    Creates override.conf in /etc/systemd/system/logitechmediaserver.service.d

    Optionally, to guard against time never synchronizing:

    Drop a systemd snippet under the systemd time wait sync service, to time out after 5 minutes, easy way:

    Code:
    sudo systemctl edit systemd-time-wait-sync.service
    
    Text needed:
    
    [Service]
    TimeoutStartSec=5m
    Creates override.conf in /etc/systemd/system/systemd-time-wait-sync.service.d

    Thoroughly test, and report back !

    Edit: I fixed a typo or two in the original post.
    Last edited by mrw; 2021-10-13 at 10:43. Reason: typo

  8. #8
    Senior Member
    Join Date
    Jun 2017
    Posts
    534
    Quote Originally Posted by Man in a van View Post
    ....
    pCP was rejected, Network wait is enabled, and as stated in the opening post, it is desired to power down the pi in between usage.
    ....
    ronnie
    Sorry! I did see that leaving the Pi powered down when not in use was the current practice, but did not understand that continuing to do that was necessarily a goal. That was my failure to think it through. Obviously, if the solution were that simple, you would have already suggested it!
    LMS 8 nightly running on Raspberry Pi OS. Mostly virtual players, occasionally with SB Radio, Boom or Classic.

  9. #9
    Senior Member
    Join Date
    Jan 2011
    Location
    Staffordshire. UK
    Posts
    4,743
    Quote Originally Posted by RobbH View Post
    Sorry! I did see that leaving the Pi powered down when not in use was the current practice, but did not understand that continuing to do that was necessarily a goal. That was my failure to think it through. Obviously, if the solution were that simple, you would have already suggested it!

    Well not necessarily

    All input is useful, as it often joggs the old memory

    I try (and fail miserably most times) to stay away from the periphery and answer only to the question posed by the poster.

    In this case, I know the poster a little, and so ignored the obvious (that was bought up by others on the original (other) forum thread).

    What I should have done, was post a more detailed explanation at the start

    Name:  facepalm.png
Views: 94
Size:  114.3 KB

    ronnie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •