[Tutor] hot to run python script at the startup

Alan Gauld alan.gauld at btinternet.com
Sun Jul 25 01:39:06 CEST 2010


"ANKUR AGGARWAL" <coolankur2006 at gmail.com> wrote

> hey fellas i have a script abc.py with me....
> i want to execute it as soon as i my linux gets start after entering
> username and password thing (desktop thing)
> how can i do that???

It depends on the shell that you use but if you use bash then you
can add a line to your .bash_profile or .bashrc file.

Which is best depends on whether you want it to run everytime
you login to your account (eg su from root) or only when you first
login etc. A full explanation can be found here:

http://www.linuxfromscratch.org/blfs/view/6.3/postlfs/profile.html

Different shells use different startup files.

This is more about Linux than Python.
To run the python script just add a line like:

python abc.py

in whichever file you decide is most appropriate.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list