1

Could any one please suggest me on which boot level or /etc/rc.x folder should I include my shell script so that it runs automatically immediately after login or just before the system prompts for login in LTS 12.04

Thanks

Harsha
  • 11
  • 3
  • see this http://askubuntu.com/questions/814/how-to-run-scripts-on-start-up – Bibi424 May 21 '14 at 12:53
  • 1
    Look at this this [Run a startup script with lightdm](http://askubuntu.com/questions/74189/run-a-startup-script-with-lightdm) or [Script to run when starting a user session](http://askubuntu.com/a/123758/265974) for a script after login use this [Where are the startup scripts for Unity Desktop?](http://askubuntu.com/a/462395/265974) – TuKsn May 21 '14 at 12:57

2 Answers2

0

You may have it to run at runlevel 3, according to this http://en.wikipedia.org/wiki/Runlevel#Ubuntu.

I guess you can be sure to do the right thing not creating these links by yourself, but by using ad-hoc, standard programs. The usual command-line one is update-rc.d. Its manual page in section 8 of the manual is rich of details.

Lorra
  • 186
  • 1
  • actually running at runlevel 2 is working. As the documentation says for the ubuntu in the given link if i am running the script in third level the system is not making any attempts to run it. – Harsha May 22 '14 at 10:14
  • Sorry about that, it was a typo! – Lorra May 22 '14 at 12:17
0

After login with your user add your script in ~/.bashrc file to run your script whenever the user login. Give execute permission on file.

sudo chmod +x script.sh

If you want to add these script for all user copy your script in /etc/profile.d/ directory.

Abdul Kadir
  • 333
  • 1
  • 9