Running Raspbian desktop. [ I'm afraid I had not much experience using Linux in general, and none with systemd ] : where, praytell, should I put a startup shell script to run once upon my user ("Pi" of course) auto-logs-in at the desktop ? The script I have in mind is meant to automate the start'n'forking of things like autocutsel and x2vnc, instead of launching them "manually" each time over.


What I've done in the past is to put startup tasks in the users .xinitrc file (/home/pi/.xinitrc in this case). This should launch when the desktop start up. Just make sure the file has executable permissions.

I used this to start up a kiosk GUI app on a RasPi when the user was auto-logged in. Here's an example script I used to start up the Python based app:

xset -dpms
xset s off
cd ~/app_dir
exec python kiosk_app.py
  • This method did [edited] not work for me : Any /home/pi/.xinitrc script is ignored in the boot process (not executed, not sourced...) 2. An /home/pi/xsession gets executed, however it thus replaces rather than complement the regular xsession thus does not start a full desktop environment and session. 3.What does 100% work for me is to have my custom init script called from the /etc/xdg/lxsession/LXDE-pi/autostart cf link – NimbUs Dec 26 '19 at 19:38
  • What I have works just fine in my setup, but it was from about a year ago so there may have been changes to how Raspbian boots since then. – John S Dec 26 '19 at 20:06
  • I didn't doubt your setting works for your needs. Our situations differ, first - as you said - our versions of the Raspbian OS; second, the programs I want launched apparently cannot be run too early, but only after the LXDE (PIXEL) desktop is in place - which is what autostart affords. – NimbUs Dec 26 '19 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.