Find the answer to your Linux question:
Results 1 to 5 of 5
How do i make it so when a admin logs on to the shell it runs a certain script? Thanks...
  1. #1
    Just Joined!
    Join Date
    Dec 2011
    Posts
    7

    Shell question

    How do i make it so when a admin logs on to the shell it runs a certain script? Thanks

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    955
    When anyone logs in (or opens an xterm) a script in their home directory called.bashrc is run automatically. If you modify root's .bashrc to do the things you want, they will be done on every root login.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  3. #3
    Just Joined!
    Join Date
    Dec 2011
    Posts
    7
    Thank you for the help this is very awesome. To the shell script menu that is gong to eat up my time most of the week. AWAY!!!!

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,970
    Actually, .bashrc is run every time a shell is started. You want to use .bash_profile for scripts that are only run when a user logs in.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Linux Guru
    Join Date
    May 2011
    Posts
    1,838
    Good point, rubberman.

    @OP,
    I tend to use customized scripts in /etc/profile.d/*.sh for this purpose, when I want system wide things to happen at login.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...