h3x.se spotify remote

24Apr/113

Mac Servify autostart tip

Another tip submitted by a user:

Tip for autostarting Servify on a Mac:
Create this one-line AppleScript in AppleScript Editor:
do shell script "cd /Applications/Servify; mono Servify.exe username password 1337 320 >/dev/null 2>&1 &"
Save the script as a run-only application. Finally add the saved application to the Login items of your account settings.
Details at http://iloapp.vidartysse.net/blog/vidarismer?Home&post=5

Filed under: servify Leave a comment
Comments (3) Trackbacks (0)
  1. johannes-

    I am setting up custom scripts to start and kill servify because it hangs in the shell if an error occurs and requires a kill pid.

    I was wondering if theres a way to make this apple script run the mono servify.exe first, then supply the login details. Currently it runs the process with a pid that includes your login information in plain sight whereas the manual route only shows “mono servify.exe”. its a bit of a security risk.

    do you know how to tailor this script to run a bit more like the manual start/connect process?

  2. Matt,
    there is a linux tool called “expect” which you might be able to use (not really sure here). There has also been support for loading credentials from a file: “mono Servify.exe login.txt” where login.txt has following layout:
    username=somename
    password=somepass
    bitrate=320
    port=1337

  3. Thanks for the tip on expect.
    I have now changed my AppleScript to run this line:

    do shell script “cd /Applications/Servify; expect start-servify.expect >/dev/null 2>&1 &”

    and created the file start-servify.expect like this:

    spawn mono Servify.exe
    expect {*Username:*}
    send my-user-name\r
    expect {*Password:*}
    send my-password\r
    expect {*Use defaults?*:*}
    send n\r
    expect {*ListenPort:*}
    send 1337\r
    expect {*Bitrate*:*}
    send 320\r
    set timeout -1
    expect timeout

    Seems to work fine. Now locking down access to start-servify.expect should provide enough security.


Leave a comment

No trackbacks yet.