Run script on login (script with sudo) or startup

Solution 1:

1. Using /etc/profile.d

You can run the script on login by placing the script in /etc/profile.d/

These files are executed upon login.

To create a symbolic link to the file you want to execute, use

sudo ln -s /home/karl/.scripts/startup/sensei-raw-startup.sh /etc/profile.d/myscript.sh

2. Using upstart

Another possibility is to use upstart

start on desktop-session-start

and place your script there.