Commit b9f379c1 authored by 孙 楠's avatar 孙 楠

use iTerm

parent 9898e431
#!/usr/bin/env bash #!/usr/bin/env bash
if [ -n "$AUTO_LOGIN_HOME" ] ; then if [ -n "$AUTO_LOGIN_HOME" ] ; then
# sleep 2
. "$AUTO_LOGIN_HOME/config" . "$AUTO_LOGIN_HOME/config"
token=$(python "$AUTO_LOGIN_HOME/onetimepass.py") token=$(python "$AUTO_LOGIN_HOME/onetimepass.py")
# echo ${token}
expectlogin.sh ${username} ${password} ${host} ${token} expectlogin.sh ${username} ${password} ${host} ${token}
else else
echo "AUTO_LOGIN_HOME not config" echo "AUTO_LOGIN_HOME not config"
......
#!/usr/bin/expect #!/usr/bin/expect
#trap sigwinch spawned
trap {
set rows [stty rows]
set cols [stty columns]
stty rows $rows columns $cols < $spawn_out(slave,name)
} WINCH
set username [lindex $argv 0] set username [lindex $argv 0]
set password [lindex $argv 1] set password [lindex $argv 1]
set host [lindex $argv 2] set host [lindex $argv 2]
......
#!/usr/bin/osascript
# refrence http://www.carlosabalde.com/blog/2016/07/05/scripting-iterm2-using-applescript
set commands to { ¬
{ ¬
connection: "alogin", ¬
action: "tail -f /home/quant_group/logs/di-ting.log" ¬
}, ¬
{ ¬
connection: "alogin", ¬
action: "tail -f /home/quant_group/logs/di-ting.log" ¬
}, ¬
{ ¬
connection: "alogin", ¬
action: "tail -f /home/quant_group/logs/di-ting.log" ¬
} ¬
}
tell application "iTerm"
create window with default profile
# Create tab
-- tell current window
-- create tab with default profile
-- end tell
# Create sessions
# TODO for each
tell current session of current window
set num to count of commands
repeat with i from 1 to num -1
split vertically with default profile
end repeat
end tell
-- tell session 4 of current tab of current window
-- split horizontally with default profile
-- end tell
# Establish connections & execute actions.
repeat with i from 1 to count of commands
tell session i of current tab of current window
set name to "SSH"
write text (connection of item i of commands)
-- delay 1
-- write text (action of item i of commands)
end tell
end repeat
end tell
-- osascript -e ''
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment