Running a script after startx automatically

17,948

startx uses the ~HOME/.xinitrc file to load programs at the startup of X where ~HOME is the home directory of the user running X [ in this case pi]

see http://www.x.org/archive/X11R6.8.1/doc/startx.1.html for an example of .xinitrc

Share:
17,948
Romain Pellerin
Author by

Romain Pellerin

I am a Software Engineer at Doctolib.fr. I usually spend my time programming or having fun in a terminal. I am In love with GNU/Linux. I like writing stuff in LaTeX. I also play the guitar. Apart from computers, I am also interested in space exploration, AI and self-driving electric cars. I look forward to a future with a lot less pollution. I try to read books as often as possible, in English and French. I am also a huge fan of comics. I write blog posts quite extensively on my personal website (http://romainpellerin.eu), not only about computer science but also broader topics such as the environment, my travels or politics.

Updated on June 19, 2022

Comments

  • Romain Pellerin
    Romain Pellerin almost 2 years

    With my Raspberry Pi, I managed to login pi user automatically, then start tomcat automatically and then start X server as well.

    For those interested, auto login:

    1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
    

    instead of

    1:2345:respawn:/sbin/getty 115200 tty1
    

    in /etc/inittab

    and

    sh /home/pi/apache-tomcat-7.0.47/bin/startup.sh
    su -l pi -c startx
    exit 0
    

    in /etc/rc.local

    Now, I'd like to launch a java program (jar file) that I made, automatically after server X has started. How could I do that?

    Thank you

    UPDATE: On my Rapsberry, as LXDE is used, http://wiki.lxde.org/en/Autostart solved my problem.