AppleScript

AppleScript连接CentOS开启ios-ipa-ser

2017-09-13  本文已影响18人  十一岁的加重

场景 :ssh 连接服务器要求输入密码
然后切换文件夹,使用命令ios-ipa-server,开启下载ipa的服务


tell application "Terminal"
        
-- 终端执行命令
    do script "ssh devops@我们的CentOS服务器IP地址"
    delay 0.8
    tell application "System Events"
        tell process "Terminal"
--活跃窗口,靠前来
            set frontmost to true
            keystroke "ssh连接CentOS服务器时需要的密码"
            keystroke return
-- 这里我们切换到所有文件夹
            keystroke "cd 一个文件夹名字而已/"
            keystroke return
-- 真实的场景是我还得切换一下,这个文件夹下面有我们已经打好的ipa
            keystroke "cd 一个文件夹名字而已/"
            keystroke return
-- screen ssh断开后执行后台任务的工具 得安装一下
-- 杀掉所有screen的后台进程,以便重新更新ios-ipa-server
            keystroke "pkill screen"
            keystroke return
            delay 1
--开启虚拟终端,这样我们电脑关了terminal,服务器也能在后台继续执行ios-ipa-server
            keystroke "screen -S lammps"
            keystroke return
            delay 1

-- 用ios-ipa-server设置一下ip,因为不设置使用默认的打不开,当然在OSX上自动设置是可以的
            keystroke "ios-ipa-server --ip 我们的CentOS服务器IP地址"
            keystroke return
            delay 1
--调起谷歌
            tell application "Google Chrome"
--如果没有运行,就运行
               if it is not running then
                    activate
                end if
                set activeIndex to get active tab index of window 1
                tell window 1
-- 新开tab 打开下载页面查看是否开启ios-ipa-server成功,也好方便把地址复制给测试人员下载
                    set newTab to make new tab with properties {URL:"https://我们的CentOS服务器IP地址:1234/download"}
                end tell
            end tell
        end tell
    end tell
    
end tell

上一篇下一篇

猜你喜欢

热点阅读