1

I'm trying to set up a automatic PDF-Viewer via a Raspberry Pi. The problem I'm facing is that the script I started from an udev-rule is doing anything I want, except starting any external program. When I'm runnig both scripts from terminal, everything works fine as well, xpdf is launched with no problems. This is how my scripts look right now:

startpdf (successfully executed from a udev-rule)

!#/bin/bash
/usr/local/script/pdfscript &
exit 0

pdfscript

!#/bin/bash
mkdir -p /media/usb/stick
sudo mount /dev/usbstick /media/usb/stick
/usr/bin/logger Testing the Script
sudo mkdir -p /usr/local/script/testfolder
/usr/bin/xpdf

Everything is working fine, the testfolder is created and the logger is doing fine as well. The reason for having two scripts is the short amount of time before a udev-started script is terminated.

The only problem is that xpdf won't start. I tried it with libreoffice or any other program too and I don't know what am I missing.

Please help me, It's driving me nuts :(

J. Dahme
  • 15
  • 4
  • 1
    I would suggest your issue is the fact that there is no X-Windows session assigned to allow xpdf to open. – Raman Sailopal Jul 06 '17 at 11:47
  • Thank you! That's new for me, what can I do about this? – J. Dahme Jul 06 '17 at 11:50
  • `udev` scripts are not meant to be daemons. `udev` kills the process shortly after it starts. Also see @Rolf's answer at [How to run Python script on USB flash-drive insertion](https://stackoverflow.com/a/44898040/608639): *"Starting daemons or other long-running processes is not appropriat for udev; the forked processes, detached or not, will be unconditionally killed after the event handling has finished."* – jww Jul 06 '17 at 12:03

0 Answers0