Acabei de escrever um aplicativo automático usando o AppleScript (junto com algumas linhas de bash) para iniciar o FTP com um único clique. No entanto, corre mais do que um tad lento. Aqui está o código:
set ftpstatus to "off" try do shell script "echo "QUIT" | telnet 127.0.0.1" & " ftp 2>&1 | grep "Escape character is" > /dev/null" set ftpstatus to "on" on error set ftpstatus to "off" end try if (ftpstatus = "off") then set ipaddr to IPv4 address of (get system info) set sun to short user name of (get system info) do shell script "sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist" with administrator privileges tell application "Finder" to display alert "FTP Launched and ready for file-transfer" & character id 8233 & character id 8233 & character id 8233 & "Address: ftp://" & ipaddr & ":21" & character id 8233 & "User Name: " & sun else do shell script "sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist" with administrator privileges tell application "Finder" to display alert "FTP session closed" end if Aqui está o que o código faz:
. - Verifique se o servidor FTP está sendo executado
- se sim, desligue-o e jogue uma caixa de mensagem dizendo "FTP Session Fechado"
- se não, ligá-lo e jogar uma caixa de mensagem dizendo "Sessão FTP Abrir" junto com meu endereço IP e nome de usuário
Este script funciona como charme, mas já que é muito lento, eu estou querendo saber se há alguma maneira de convertê-lo para um script de shell bash. Isso deve acelerar muito as coisas. Alguma sugestão?