Skip to content

Instantly share code, notes, and snippets.

@preble
Created August 15, 2018 01:53
Show Gist options
  • Save preble/75b4da2f36f39d48ff6ed2a175b66fd5 to your computer and use it in GitHub Desktop.
Save preble/75b4da2f36f39d48ff6ed2a175b66fd5 to your computer and use it in GitHub Desktop.
Autostart JMRI PanelPro on a Raspberry Pi -- without launching two instances.
# Full path: /home/pi/.config/lxsession/LXDE-pi/autostart
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xset s off
@xset -dpms
@xset s noblank
@/home/pi/jmri-runner.sh
#!/bin/bash
# Full path: /home/pi/jmri-runner.sh
# Sleep to hopefully wait until the window manager is fully started.
# Added because I would sometimes start up the RPi and find that PanelPro was running,
# but not visible in the window manager. Maybe there is a better way?
sleep 10
lock=/tmp/jmri-runner.lock
flock --nonblock $lock ~/JMRI/PanelPro
if [ $? -ne 0 ]; then
echo "PanelPro is already running. $lock is locked."
exit 1
fi
@Erik84750
Copy link

Erik84750 commented Oct 27, 2022

Does not seem to run on my setup (Rpi4B with Buster, updated and upgraded), Java 11.0.16, headless with TightVNC

  1. lxsession is not present in my .config, instead there is /home/pi/.config/lxpanel/LXDE-pi, where I copied the autostart file
  2. JMRI sits in /home/pi/Documents/JMRI
  3. I adjusted the JMRI location in line 11 of autostart

Please help?

EDIT: according to https://forums.raspberrypi.com/viewtopic.php?t=294014 the autostart feature (system) for Buster resides in /etc/xdg/lxsession/LXDE-pi/ but when editing the autostart file already present there with the commands shown here, there still is no autostart of PanelPro

EDIT 2: and when creating the /home/pi/.config/lxsession folder and associated files, with the updated autostart file, still no PanelPro autostart.

EDIT 3: jmri-runner.sh must be made executable. When done now PanelPro autostarts.
I think issue is solved.

@Erik84750
Copy link

Erik84750 commented Feb 11, 2023

Even with 20 seconds delay the program (PanelPro) does not show up on the desktop even though the Taskmanager shows it running.
What to do?

EDIT: I have TightVNC server running from startup. Could that be the reason for not showing on a hdmi-connected monitor?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment