Terminal and Unix Executable Startup Item

Jump to First Reply
Posted:
in Genius Bar edited January 2014
Through Terminal using the command man tcsh > new_file I created this file.



Then I opened the new_file and placed a terminal command that I want done each time my mac starts up.





I then used terminal to move the file into the /System/Library/StartupItems





I then ran the terminal command chmod u=rwx,g=rx,o=r





This set the permissions on the file and made it a Unix Executable File.





I restarted my computer and this command is not starting up when the computer launches.



I know the file command is good because I can double click on it and it will launch in the terminal asking me for my password.



After I put my password in it executes.



1. What am I doing wrong?



2. How do I make it start when my computer starts up?



3. Do I need to set something in it to work around it asking for a password to execute?



4. Do I have to set a path to that file to force OS X on Boot to Initalize that Unix Executable File?







Any help would be greatly appreciated.



Thanks in Advance,

Apple are good for you

Comments

  • Reply 1 of 4
    lundylundy Posts: 4,466member
    StartupItems is deprecated.



    Put the shell script in your Login Items list - use the Accounts pane in System Preferences.



    If you don't mind storing the password in a script, you can write a one-line AppleScript using a "do shell script" command to do it, and include the password there. Ask if you need details of this.



    If the script is supposed to apply to all accounts, you'll have to use launchd to run it. This requires putting a preference list (plist) in /Library/LaunchAgents. Download Lingon to make the plist with.
     0Likes 0Dislikes 0Informatives
  • Reply 2 of 4
    Jonny,





    I want this terminal command to run on all users of the computer. I want it running at the root of the computer and one of the first things to load when the computer starts up. Can you give me more instructions on launchd and how do I set this up?
     0Likes 0Dislikes 0Informatives
  • Reply 3 of 4
    lundylundy Posts: 4,466member
    Quote:
    Originally Posted by Applesaregoodforyou View Post


    Jonny,





    I want this terminal command to run on all users of the computer. I want it running at the root of the computer and one of the first things to load when the computer starts up. Can you give me more instructions on launchd and how do I set this up?



    OK let me ask some questions.



    1) By "running at the root", do you mean running in the background the whole time, what we call a daemon? Is there something it needs to do all the time, or just at startup?



    2) By "all users", would it suffice for it to be launched by each user when they log in?



    3) You'll probably have to post the shell script for me to tell where it should reside.



    I ask because if you really do not need a startupitem, it is much easier and quicker to do. True startupitems have a lot of coding.
     0Likes 0Dislikes 0Informatives
  • Reply 4 of 4
    I think I got it working, I will know in the next couple of days. If not I will shoot you over an email.
     0Likes 0Dislikes 0Informatives
Sign In or Register to comment.