Opening PDF at startup

My apologies, I am probably missing something obvious. I am trying to setup OpenSUSE 15.2 Leap as a kiosk that will cycle through a PDF full of images.
I have a script that contains

evince /home/lobbypc/Documents/test.pdf &

I can open a terminal, run the script, and everything works fine. But I cannot get the script to run at startup.

My last attempt was to create /etc/systemd/system/script001.service which contained the following:


# /etc/systemd/system/script001.service
#

[Unit]
Description=Run my boot script

[Service]
Type=oneshot
ExecStart=/bin/sh -c "/home/lobbypc/bin/slideshow.sh"

[Install]
WantedBy=multi-user.target

I then started and enabled the service and rebooted. Script did not run. Any suggestions greatly appreciated. Thanks!

Hi
Just autostart when the kiosk user logs in? Your wanted by is incorrect, multi-user is console, graphical is a GUI session…

I corrected that, but now I get this…

Aug 28 10:07:22 pc344 sh[3268]: Unable to init server: Could not connect: Connection refused
Aug 28 10:07:22 pc344 sh[3268]: Cannot parse arguments: Cannot open display:

I’m searching for a solution, but any help appreciated.

Hi
You either need to use as a ‘user’ systemd file, or have the X/Wayland/Sway/Cage etc system up and running and autostart via a desktop file, or in .profile.

Is all your wanting to run is this pdf?

The plan is for this PC to just sit there and continually run this PDF as a slideshow in our building lobby. Currently doing this with a Win10 box, but it doesn’t work the best. What I had hoped to do though, was to have a script that I would cron that would check a network folder for a PDF file. Any time that folder contained a PDF, the script would copy it locally, kill the current PDF display, and display the new one. Which as I am thinking this through means that I really don’t need to have the script run at startup. Cron will handle running the script.

Hi
Cron is dead! :wink: Use a systemd timer and the the service to start the job :wink: I would look at using cage then along with a JeOS setup created via kiwi? Have a read here: https://forums.opensuse.org/showthread.php/535802-What-is-the-minimum-package-list-for-Wayland

You do not say which desktop you use, but DEs normaly have a place where you can configure things to be started at login.

What you show is on the system level, not on the “user in s desktop” level. And thus it starts things at boot far before any user is loged in at all.

This is getting frustrating. I can’t even think about any of that because now I find a problem with Evince. Evince will display my slideshow, but it ignores the loop setting within the PDF. Gets to the end and displays “End of presentation. Press ESC or click to exit.” Do you know of a program that will run on OpenSUSE 15.2 that will display a PDF slideshow in a continuous loop?

Hi
I would try impressive http://impressive.sourceforge.net/ maybe pdfpc in X11:Utilities repo.

Any reason you’re not running your slideshow as a losckscreen screensaver?
There must be any number of solutions, either already installed on your system (depends on your Desktop) or installed app, plugin or whatever.

TSU

So Impressive does everything I want if I start it manually, but the error below showed up when I tried to run it from the script. I’m going to do some digging this morning to see if I can find a solution, but if you have any suggestions, they are appreciated.

OOPS! Impressive crashed!
This shouldn’t happen. Please report this incident to the author, including the
full output of the program, particularly the following lines. If possible,
please also send the input files you used.

Impressive version: 0.13.0-beta2 (SVN r298)
Python version: 3.6.10 (default, Jan 16 2020, 09:12:04) [GCC]
PyGame version: 1.9.6
PIL version: Pillow 5.0.0
PDF renderer: None
Operating system: Linux 5.3.18-lp152.36-default (x86_64)
Command line: /usr/bin/impressive -a 6 -w -t Crossfade -T 2500 /home/lobbypc/Documents/currentshow/test.pdf
Traceback (most recent call last):
File “/usr/bin/impressive”, line 6482, in run_main
main()
File “/usr/bin/impressive”, line 6019, in main
Platform.Init()
File “/usr/bin/impressive”, line 354, in Init
pygame.display.init()
pygame.error: No available video device
pygame 1.9.6
Hello from the pygame community. Contribute - pygame wiki

Running as a screensaver just never crossed my mind. And my first assumption would be that I would not have the control I need since I want to be able to start/stop the whole process with a script. I would like to think there are a number of solutions, I am just having a hard time finding them.

My linux servers are great, but whenever I try to use linux in a different capacity, I seem to run into roadblocks. I will admit that most of my “desktop” experience is windows, but that is because the applications we run require it. (I don’t want to go down that rabbit trail, linux on the desktop is impossible here due to the application issues) But I would like to use linux wherever I can. Malcolm suggested Impressive and that does exactly what I want if I can get it to run from a script.

Looks to me you need a GUI running before impress is started

Hi
Yes… @ketter, look at installing something like cage it’s a small footprint (I use cageX rather than wayland).

The GUI is running. I can open a terminal window and run the Impressive command line and everything works perfectly. I have a script that contains the Impressive command line. If I execute that script from the same terminal window or if I have it executed as a cron job, it fails with the error I posted. I just need to figure out why running it from the script makes a difference.

Hi
Cron knows nothing of the display, what you need to do is create a desktop file and drop it in /home/lobbypc/.config/autostart/ when the user logs in it will run…

I can understand why it does not run from cron. Cron jobs run in the background and have no connection to a GUI. Specialy not because in Unix/Linux you can have zero, one or several GUI sessions at the same time. Which one to use? The one of an innocent user who does not even own the crontab where it is running from?

And when you say it does not run from a script, then better post the script and information about the file (where is it, what are it’s permissions, who tries to start it from where). Just saying "it does not work’ gives no usable information.

My apologies…getting pulled in too many directions and really did not post complete information.

So the script not working was just typos on my part. :shame: Once I corrected those, the script worked fine when run from a terminal, but still did not work when run from cron.

And that was due to what you mention about cron jobs having no connection to the GUI. I just assumed that if a user was logged in and his GUI was running that his crontab would know to use that GUI. Bad assumption on my part. The solution I found for the GUI issue may be outdated…but I added “export DISPLAY=:0” as part of my command in cron and now everything works. The linux servers I manage don’t have/use a GUI so I have a lot to learn about working with the GUI on linux.

So my thanks to everyone who replied to this thread! I appreciate all the help getting this to work!
Ken