Mac startup script

Discussion in 'Computer Gaming Forum' started by Pikmin, Jan 26, 2012.

  1. Pikmin

    Pikmin Resolute Member

    Joined:
    Dec 23, 2009
    Messages:
    935
    Likes Received:
    95
    Hi everyone,
    I have this script that I'm trying to run at logon every time a user logs in.
    So far I've tried LoginHook and launchd and can't seem to get it right.

    Using LoginHook:
    When I login as an administrator I get it to work every time but once the computer is joined to the OD and AD and use a network account it stops working properly. Can't really put my finger on it...

    Either it stops working completely or it only works after a restart/power on.

    My understanding is that the login hook executes under root privileges. Because the network accounts take longer to authenticate the script seems to run before the user is logged in completely.
    I had to put a sleep 20 command in the script so that the .app runs and mounts the network shares using the logged in user not root and that works fine.

    From what I've read online, lauchd is the way to go, but it can only run during startup or on demand.

    Still not sure why it doesn't execute properly every time during logon. So intermittent

    Any suggestions are welcome :D

    EDIT: to make things more clear, i'm trying to run an .app and using a simple script to execute it
     
    Last edited: Jan 26, 2012
  2. Bad_Ad84

    Bad_Ad84 The Tick

    Joined:
    May 26, 2011
    Messages:
    8,566
    Likes Received:
    1,308
    Google launchd and write a plist for it.
     
    Last edited: Jan 26, 2012
  3. Pikmin

    Pikmin Resolute Member

    Joined:
    Dec 23, 2009
    Messages:
    935
    Likes Received:
    95
    That's what I've been trying to do for the last two days. Finally got it today
    Thank you! :)
     
  4. la-li-lu-le-lo

    la-li-lu-le-lo ラリルレロ

    Joined:
    Feb 8, 2006
    Messages:
    5,657
    Likes Received:
    238
    You are aware of the "Open at Login" option, right?
     
  5. Pikmin

    Pikmin Resolute Member

    Joined:
    Dec 23, 2009
    Messages:
    935
    Likes Received:
    95
    Yes I am, thank you, but that only works for accounts already created on the machine if I'm not mistaken
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page