help: lingon terminal command at startup python string

Discussion in 'Jailbreaks and iOS Hacks' started by lawlist, Dec 12, 2010.

  1. lawlist macrumors member

    May 19, 2010
    In order to connect the iphone via ssh over usb on the mac, it is necessary to run a terminal command. Can anyone please help me figure out how to have a simple command string run in the terminal every time I startup, and have the terminal window close automatically when it is done? I have lingon, which should make it easy, but I still need help. I created a "user agent", but it doesn't seem to be doing the trick and there are no error messages. Here is the string I need to run from terminal every time the computer starts up (and then close the terminal after the string is run):

    python /Applications/python-client/ -t 22:2222 &

    Or get to the directory /Applications/python-client, and then run

    python -t 22:2222 &


    Attached Files:

  2. lawlist thread starter macrumors member

    May 19, 2010
    I wrote a simple shell script with 755 permissions and used lingon to execute the shell script with a user agent -- command string "sh [absolute path to shell script]".


    # iphone usb ssh script

    /Applications/python-client/ -t 22:2222 &

    However, I was unable to figure out how to force the full command string to execute without a shell script just by running a user agent at logon -- the farthest I got was executing without the arguments, and am not sure why the arguments are not recognized -- looking in /var/log/system.log revealed that was being executed without arguments despite the user agent seemingly containing the correct arguments.
  3. ninjabytes macrumors newbie

    Oct 3, 2010
    If I am reading this correctly you could just go to Preferences in Terminal (⌘ + ,) Settings > Shell: Startup then ✓ the 'Run command:' box and type in what you think is the best solution.

    You could type: cd /Applications/python-client; python -t 22:2222 &

    While in Settings > Shell: When the shell exits: and select the Close the window option.

    Regarding Lingon I haven't personally used it… One question why did you want to ssh via USB? :rolleyes:

    Attached Files:

  4. lawlist thread starter macrumors member

    May 19, 2010
    Thank you -- I just tried your method and that is indeed a viable alternative. After contacting the Lingon developer a few weeks back, who told me that he also uses shell scripts for more complicated jobs, I chose to use "Platypus-4.4" to create an app with a built-in shell script, and I used the OSX login system preferences to select the app I created -- the script was just two lines:


    /usr/bin/python2.6 /Applications/python-client/ -t 22:2222 &

    The reason for this project is that I have a jailbroken iPhone with iOS 4.1, and I synchronize my 10GB master database by transferring files to / from the iOS device using a usb connection to the Mac, instead of wireless. The result is that I can transfer multiple files and/or very large files at maximum data transfer speeds. With this setup, I just hook up the iPhone to the Mac with the usb cable and it is ready for usb data transfer using ForkLift2. I did this on the desktop, and on the two laptops.
  5. ninjabytes macrumors newbie

    Oct 3, 2010
    Ahh, That is a hefty file for ssh via wireless I see why you use the ForkLift2 method!!
    Also, that solution made me recall Apple Script Editor which is perfect for something i was working on. I should be thanking you! xD

Share This Page