Caleb9 / syno-photo-frame

Build a digital photo frame for Synology Photos with Raspberry Pi
GNU General Public License v3.0
39 stars 3 forks source link

Start and (!) stop with crontab #7

Closed sks7g closed 8 months ago

sks7g commented 9 months ago

I need your help again, my Linux time was a while ago.

I had tried, as you explained, to start syno-photo-frame via the crontab after the reboot. Unfortunately this did not work, it was missing some environment variables on startup, even on delayed startup.

So I created a script under /etc/xdg/lxsession/LXDE-pi/autostart @lxpanel --profile LXDE-pi @pcmanfm --desktop --profile LXDE-pi @xscreensaver -no-splash syno-photo-frame --order random -i 5

This now works, after every restart via "Witty Pi 3 Mini" syno-photo-frame starts at 5 o'clock in the morning. And AdGuardHome also starts in the background. The system then goes back to sleep at midnight.

Now I want syno-photo-frame to start at 3 pm and stop at 10 pm. But ... the system (because of AdGuardHome, bin homecameras) must be run's all day, all time (basically I don't need a Witty Pi 3 Mini).

A solution via the crontab unfortunately fails because of the stop script. A simple search for the process ID and then kill.

After the kill, the restart of syno-photo-frame unfortunately ends with ... The path /dev/dri/ cannot be opened or is not available The path /dev/dri/ cannot be opened or is not available 2023-12-10T14:26:50.011Z ERROR [syno_photo_frame] No available video device Error: "No available video device"

My Start-Skript

!/bin/ksh

Info : /etc/xdg/lxsession/LXDE-pi/autostart

syno-photo-frame --order random -i 5

My Stop-Skript

!/bin/ksh

Info : /etc/xdg/lxsession/LXDE-pi/autostart

date >>/home/rasp/logs/foto.log pidof syno-photo-frame &>>/home/rasp/logs/foto.log sudo kill -9 pidof syno-photo-frame &>>/home/rasp/logs/foto.log

Any tip, can you help me (again) :) thx Erik

Caleb9 commented 9 months ago

Hi Erik,

Your setup is way more complex than mine. I have a dedicated Pi Zero 2 for the photo frame only. So I can only speculate. I suspect it may be because you're running some desktop environment along with syno-photo-frame, so maybe something reserves the graphics card when you try to start it again? Do you need the desktop, and have you tried to use the Raspberry Pi OS Lite edition?

Btw. simple killall syno-photo-frame works for me, I don't think it's necessary to search for specific pid.

sks7g commented 9 months ago

Hi, I have installed raspberry Pi OS Lite edtion, and ... syno-photo-frame (syno-photo-frame_0.7.0_arm64_bullseye.deb) without complication.

The result of my first start (via ssh)... xxxx@raspberrypi:~ $ syno-photo-frame http://diskstation2:5000/mo/sharing/T1NbdQY8n The path /dev/dri/ cannot be opened or is not available The path /dev/dri/ cannot be opened or is not available 2023-12-13T09:14:42.243Z ERROR [syno_photo_frame] No available video device Error: "No available video device"

Any tip, the screen is running, I see the console. The error occurs when I work directly on the raspberry console.

I have this screen ... RASPBERRY PI 7TD 7" TFT LCD-Touch-Display, 800 x 480 pixel

A small hurdle still had to be overcome with the display (dtparam=i2c_vc_baudrate=50000" to /boot/config.txt) I can start, stop with killall and start again without any problems. So it should work via the crontab (on/off).

Thank you.

Caleb9 commented 9 months ago

Hmm, unfortunately I don't have access to the Raspberry Pi touch screen, which I know is using different connector than HDMI (which I use with a regular monitor), so I have no way currently to experiment with this. :( What kind of problem with the display did you solve with dtparam? I can see that documentation recommends not to use i2c_vc_baudrate under normal circumstances...?

To sum up, you can start syno-photo-frame when connected to RPi directly (e.g. keyboard plugged into USB port) but not via SSH, is that correct?

Edit: also, just to make sure, your user is in the video group (check with groups command), right? Also, because you have some i2c enabled by dtparams, check if you're in i2c group... but that's a blind shot.

On Pi 5 currently for me the contents of /dev/dri look like this:

pi@pi5:~ $ ls -l /dev/dri/
total 0
drwxr-xr-x 2 root root        100 Dec 13 14:42 by-path
crw-rw---- 1 root video  226,   0 Dec 13 14:41 card0
crw-rw---- 1 root video  226,   1 Dec 13 14:42 card1
crw-rw---- 1 root render 226, 128 Dec 13 14:41 renderD128

How does it look in your case?

sks7g commented 9 months ago

Short summary, so I got it to work, somehow, i2c_vc_baudrate I took it out again commented. My start and also my stop script works (including screen on and off).

Yes the screen is connected via the 40 pin header and a ribbon cable, not HDMI directly.

But now I have problems with WittyPi4, the software script and WEB has communication problems. I'll see if I invest any more time in this, or take the board out again (if only I could find my old micro USB power supply again, I'm getting old).

But thanks for your help, support