Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Run script AFTER login

  1. #1
    Join Date
    Jul 2009
    Beans
    29

    Run script AFTER login

    I need to run the same script for every user who logs on. Adding it to the rc*.d is not an option since it needs to run after after users login, and manually editing the each users .profile (or System -> Preferences -> Startup Applications) is unreasonable. Did a quick search, and all the results seemed to be for a single user. How can I run the same script for all users after they login?

  2. #2
    Join Date
    Feb 2009
    Location
    Netherlands
    Beans
    784

    Re: Run script AFTER login

    Put a launcher in /etc/xdg/autostart and the script somewhere else, eg /usr/local/bin

  3. #3
    Join Date
    Jan 2009
    Beans
    Hidden!

    Re: Run script AFTER login

    If it's something that should run after login but before the session manager is launched, then you can put it in /etc/X11/Xsession.d/. The files there are numbered to maintain execution ordering, just like the ones in /etc/rc*.d/.

  4. #4
    Join Date
    Jul 2009
    Beans
    29

    Re: Run script AFTER login

    So I placed the following test script

    Code:
    #!/bin/sh
    
    xterm &
    in /etc/X11/Xsession.d which executable permissions and a name of "startup" - it doesn't seem to be starting. Any ideas why?

  5. #5
    Join Date
    Aug 2006
    Beans
    Hidden!
    Distro
    Kubuntu 9.04 Jaunty Jackalope

    Re: Run script AFTER login

    Probably a simpler way mentioned here will suffice?
    I laugh in the face of danger:
    then hide until it goes away.

  6. #6
    Join Date
    Jul 2009
    Beans
    29

    Re: Run script AFTER login

    Quote Originally Posted by nikhilk View Post
    Probably a simpler way mentioned here will suffice?
    I don't believe so - from what I understand, that only works for the user who does that. If John adds the start up script using that method, then Mary logs on, the script won't start for her. VCoolio's method seems to work though.

  7. #7
    Join Date
    Aug 2006
    Beans
    Hidden!
    Distro
    Kubuntu 9.04 Jaunty Jackalope

    Re: Run script AFTER login

    Quote Originally Posted by 696f6e6963 View Post
    I don't believe so - from what I understand, that only works for the user who does that. If John adds the start up script using that method, then Mary logs on, the script won't start for her. VCoolio's method seems to work though.
    Oops, mea culpa! I did not read your first post correctly. Yes this method is user specific and won't work for all users.
    I laugh in the face of danger:
    then hide until it goes away.

  8. #8
    Join Date
    Mar 2009
    Beans
    927
    Distro
    Ubuntu 12.04 Precise Pangolin

    Lightbulb Re: Run script AFTER login

    Couldn't you put it in /etc/profile?

  9. #9
    Join Date
    Jul 2009
    Beans
    29

    Re: Run script AFTER login

    I did try that, as well as adding a script to /etc/profile.d/ - I didn't seem to have much luck. I probably did something wrong though.

  10. #10
    Join Date
    Apr 2006
    Location
    Ubuntuland
    Beans
    2,124
    Distro
    Ubuntu 13.10 Saucy Salamander

    Lightbulb Re: Run script AFTER login

    Quote Originally Posted by Penguin Guy View Post
    Couldn't you put it in /etc/profile?
    That file only applies to bash.
    24 beers in a case, 24 hours in a day. Coincidence? I think not!

    Trusty Tahr 64 bit, AMD Phenom II 955 Quad Core 3.2GHz, GeForce 9600 GT
    16G PC2-6400 RAM, 128 GB SSD, Twin 1TB SATA 7200 RPM RAID0

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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