I have written a script to run automatically after login.

For that I have put it in /etc/profile as:

/home/pi/myscript.sh &

However, it is executed twice instead of one. Any ideas why?

VNC and SSH have been disabled.


/etc/profile is the system-wide .profile file for the Bourne shell

It will run EVERY time you start a shell - it DEFINITELY is NOT intended to run programs on login, but to configure the shell.

  • The correct place to run programs once per specific GUI login is ~/.xinitrc, but one had to copy the global template there first and change it because that's the file that also starts the window manager.
    – Janka
    Apr 11 '18 at 9:01

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.