1. reeprflame's Avatar
    Hey all,
    I am not all that familiar with the launch process of OS X, and namely the iPhone. I am trying to get a script, or alternatively a command, executed ONLY at startup. Here is the problem I am solving:

    SpringBoard crashes on me after boot where the touchpad I/O stops working inside any application. The solution to my problem is to SSH in, run a `ps -A`, and kill -9 <process of SpringBoard> So I wrote a script to do the same thing (or a simple `killall SpringBoard` that runs *once* at boot is also sufficient). Cron jobs are not sufficent because if I need to restart my phone at any time of day, well cron jobs are useless and I don't want springboard restarting every 2 min, for example.

    So, I am trying to figure out how to use launchd or launchctl to do this (I'm assuming this is my best bet). Any ideas?
    2008-05-24 05:19 PM
  2. Egeste's Avatar
    Bump
    2008-07-19 11:38 AM
  3. spasticsurgeon's Avatar
    One thing I found interesting was that the boot scripts of the iPhone and Touch are identical, and thus when starting a Touch in verbose you notice several iPhone-only processes starting and subsequently failing because they require iPhone-only software. :-) sorry I couldnt be of more help!
    2008-07-24 07:28 PM
  4. BlackWolf's Avatar
    well, I looked it up once and the startup scripts are in some way related to /System/Library/LaunchDaemon/ ... the .plist files in there represent an application to be executed at startup. I tried adding an application by myself once but although I thought I did everything right it never worked. But you have to look there ...
    2008-07-24 07:48 PM
  5. Egeste's Avatar
    well, I looked it up once and the startup scripts are in some way related to /System/Library/LaunchDaemon/ ... the .plist files in there represent an application to be executed at startup. I tried adding an application by myself once but although I thought I did everything right it never worked. But you have to look there ...
    There is a solution to this - take a look at this article.

    So basically, you write the script, create a launchd plist config file, add the file to /Library/LaunchDaemons and then load the file using

    Code:
    launchctl load /Library/LaunchDaemons/tld.domain.subdomain.plist
    I have an example of a DynDNS updater script on my website that uses this method.

    -Egeste
    2008-12-31 07:43 PM
  6. michaelwithe21's Avatar
    i just need to add a command/script to iphone's startup, please, i have read through your links, and they all seem to be too in-depth for me implement such a simple command (terminal or not)...

    HELP!!! here are the links describing how to control your iPhone no matter where it goes.. all i need is to add it to startup!!!

    http://www.modmyi.com/forums/iphone-...ml#post4787221

    [ame=http://forums.macrumors.com/showthread.php?p=8041054#post8041054]Control your iPhone from ANYWHERE it goes - Mac Forums[/ame]
    2009-07-23 07:16 PM
  7. Egeste's Avatar
    i just need to add a command/script to iphone's startup, please, i have read through your links, and they all seem to be too in-depth for me implement such a simple command (terminal or not)...

    HELP!!! here are the links describing how to control your iPhone no matter where it goes.. all i need is to add it to startup!!!

    http://www.modmyi.com/forums/iphone-...ml#post4787221

    Control your iPhone from ANYWHERE it goes - Mac Forums
    michaelwithe21,
    launchd is well documented on the net as it is an open source project developed by Apple, and you can find a plethora of information by google-ing launchd tutorial or similar.

    That being said, i think you will find this link particularly useful.

    Also, check out the manpage for launchd and launchctl

    -Egeste
    2009-07-23 08:15 PM
  8. michaelwithe21's Avatar
    thanks man, the only reason I dont want to read-through all of this junk is because Im sure that someone els has already added a terminal command to launchd... im sure its really easy to figure out.. but I really dont have the know-how to figure it out...

    so any help for a lazy guy with a GREAT idea to be able to control your iphone no matter what network it goes onto... this could be made into an app if stable... so please, if you know of any specific tutorials that would show me what script to edit and where to add the command, i would greatly appreciate it!

    Update:

    hey, just found this junk:

    http://ask.metafilter.com/78590/How-...art-up-in-OS-X

    which led me to this app which can create deamon/launchd files... still have no clue how to use it.. im not familiar enough with it... im stupid

    http://tuppis.com/lingon/

    above is where u can download it, its called Lingon

    im gunna keep going through it and post a snapshot
    Last edited by michaelwithe21; 2009-07-23 at 08:33 PM.
    2009-07-23 08:24 PM
  9. Egeste's Avatar
    thanks man, the only reason I dont want to read-through all of this junk is because Im sure that someone els has already added a terminal command to launchd... im sure its really easy to figure out.. but I really dont have the know-how to figure it out...

    so any help for a lazy guy with a GREAT idea to be able to control your iphone no matter what network it goes onto... this could be made into an app if stable... so please, if you know of any specific tutorials that would show me what script to edit and where to add the command, i would greatly appreciate it!

    Update:

    hey, just found this junk:

    How do I execute this command at start up in OS X? | Ask Metafilter

    which led me to this app which can create deamon/launchd files... still have no clue how to use it.. im not familiar enough with it... im stupid

    Tuppis - Lingon by Peter Borg

    above is where u can download it, its called Lingon

    im gunna keep going through it and post a snapshot
    You're not stupid, you're just inexperienced. Once you figure out how launchd works you'll find yourself answering questions from people just like you who are simply inexperienced

    Don't be lazy though, and don't be afraid to RTFManpage. The developers wrote those for you.
    2009-07-23 08:37 PM
  10. michaelwithe21's Avatar
    2009-07-23 08:40 PM
  11. Egeste's Avatar
    Apple supplies a plist editor as part of their xcode suite (not sure if it's included in macos by default) but it is located at "/Developer/Applications/Utilities/Property List Editor.app"
    2009-07-23 08:47 PM
  12. michaelwithe21's Avatar
    lol, your words do not comfort me =P... i know very little about scripts in general... the most ive ever used is "do shell script" as can be seen on my "virus" or vulnerability that i wrote here:

    Just an Idea - TSF - Mac Security Forums

    but, hopefully your right, and i will do some digging within property list editor.app and launchd... but please, if you have any quick jump methods for me to just implicate a simple SSH/CLI/Terminal command, point me there =P
    2009-07-23 08:54 PM
LINK TO POST COPIED TO CLIPBOARD