How do I make a script run upon startup of the Ubuntu machine?

Solution 1:

Simple way

You can add this script into /etc/rc.local file (before exit line), e.g.

/home/myuser/go.py &

Where & at the end will run the script in the background.

Make sure that you've execution flags. To test it, simple run from the terminal:

sh /etc/rc.local

Solution 2:

You can put a script in the /etc/init.d/ directory (eg: /etc/init.d/go.py) for anything you want to run at bootup time.

http://www.debian-administration.org/article/Making_scripts_run_at_boot_time_with_Debian