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

Bodgit

Well-Known Wammer
Wammer
Feb 27, 2019
1,032
534
148
Woking
AKA
David
HiFi Trade?
  1. No
OK, pressing reset on the SBT is more trouble then hitting reboot on the iPad/Material screen 🙂

 

Man in a van

Wammer
Wammer
Sep 28, 2012
2,006
480
113
Staffordshire
AKA
Ronnie
HiFi Trade?
  1. No
Just a quick one.

I set up a cron job last night and this morning when I plugged in the pi, everything ran in a normal manner.

The time display on the Touch did not revert to 22:08 which was when I unplugged the rpi.

It needs more testing.

Back in the afternoon

 
  • Upvote
Reactions: Bodgit

Man in a van

Wammer
Wammer
Sep 28, 2012
2,006
480
113
Staffordshire
AKA
Ronnie
HiFi Trade?
  1. No
I think the result this morning was maybe an error :dunno:

Anyway before I went out, I reset the sllep time from 25 to 20.

That did not work

A return to 25 worked withe the time change being shown, but I need a longer period between reboots.

Anyway, a possible neater way of doing it is to use autostart.

I have used that before.

From the raspbeery pi forum

The autostart feature can be used to automatically start just about any app, script or command at boot (User login). Requires boot to Desktop (GUI) enabled.

Autostart is particularly useful when you need to run Desktop apps or any scripts which require Desktop (GUI).

Other methods such as rc.local or cron @reboot do not easily handle GUI programs as they attempt to start the app before the Desktop in ready resulting in failure to open.
It can also be used to start a bash script, which is what I am using at the moment for the cron job.

So, at the moment I have configured the autostart without any delay to the start (sleep) in the bash script. I want to see what happens before I add any "sleep".

I have unpowered the rpi and will wait an hour or so before starting it up.

ronnie

 

Man in a van

Wammer
Wammer
Sep 28, 2012
2,006
480
113
Staffordshire
AKA
Ronnie
HiFi Trade?
  1. No
Right, a quick how to, as Il Lombardia will be starting soon :cool:

Open a Terminal and SSH into the pi

Type

sudo apt update


  (let it complete)

sudo apt full-upgrade


(let it complete)

follow any instructions.

then

sudo reboot


SSH in again

type

sudo crontab -e


append this line to the bottom of the file

@reboot sleep 25 && sudo /usr/local/bin/restart.sh


Save and exit with ctrl + x, followed by y when prompted to save, and then enter

then make this file

type

sudo nano /usr/local/bin/restart.sh


enter text

#!/bin/bash

sudo /etc/init.d/logitechmediaserver restart


Save and exit with ctrl + x, followed by y when prompted to save, and then enter

make the file executable

sudo chmod a+x /usr/local/bin/restart.sh


   (or  chmod +x)
 
Reboot with

sudo reboot


Shut down the pi

Wait for at least one hour (longer if possible)

Boot up the pi, at around 35 secs the time on the Touch should revert to the time you shut down the pi, it should return to the current time at about 55 secs.

The Touch is now available

Time might be shorter on a rpi4 (I used a rpi3B+)

More tomorrow, hope it works for you

ronnie

 
Last edited by a moderator:
  • Upvote
Reactions: Bodgit

Bodgit

Well-Known Wammer
Wammer
Feb 27, 2019
1,032
534
148
Woking
AKA
David
HiFi Trade?
  1. No
Hey Ronnie, that works a great, perfect solution! Many thanks!

 

Man in a van

Wammer
Wammer
Sep 28, 2012
2,006
480
113
Staffordshire
AKA
Ronnie
HiFi Trade?
  1. No
Hi David, let's hope it keeps working ;-)

I have the same result running a bash script under autostart, so there is  an alternative to the cron job.

It does the same thing, so there is no improvement to be gained.

I also found a thread from 2015 hidden in the slimdevices forum which runs a script on a raspberrypi (at start up) that reboots the SBTouch (same as using the button on the back of the Touch).

I might play with that at sometime.

I'll ask, at slimdevices, next week, if it is possible to delay the LMS start :dunno:

ronnie

 

Latest posts

Forum statistics

Threads
113,444
Messages
2,451,263
Members
70,783
Latest member
reg66

Latest Articles