windowsのteratermスクリプト - part2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
include 'y:\teraIni\gvis.ini'
; --- 接続 --------------
conSTR = 'xxx.xxx.xxx.xxx /ssh /2 /auth=password /user=nari /passwd='
strconcat conSTR gvis_nari
strconcat conSTR ' /F='
strconcat conSTR gvis_iPTH
strconcat conSTR 'yellow.ini '
strconcat conSTR '/timeout='
strconcat conSTR gvis_TOUT
; ---debug --------------
; messagebox conSTR 'info'
connect conSTR
if result <> 2 goto end
wait gvis_wS1
sendln "su - "
wait gvis_wS3
sendln gvis_MAIN
conSTR = "/bin/sh /gvis/script/002_GVISbackup_Image.sh "
strconcat conSTR gvis_psw1
wait gvis_wS2
sendln conSTR
wait gvis_wS2
sendln "exit"
wait gvis_wS1
sendln "exit"
|
- 定義ファイルを利用してローカルlinuxへssh接続し、google cloudのlinuxを起動
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
include 'y:\teraIni\gvis.ini'
; --- 接続 --------------
conSTR = 'xxx.xxx.xxx.xxx /ssh /2 /auth=password /user=nari /passwd='
strconcat conSTR gvis_nari
strconcat conSTR ' /F='
strconcat conSTR gvis_iPTH
strconcat conSTR 'yellow.ini '
strconcat conSTR '/timeout='
strconcat conSTR gvis_TOUT
; ---debug --------------
; messagebox conSTR 'info'
connect conSTR
if result <> 2 goto end
wait gvis_wS1
sendln "cd /gvis/log"
wait gvis_wS1
sendln "date >> 003_gcpLog.log"
wait gvis_wS1
sendln "echo '------before Start status------' >> 003_gcpLog.log ; gcloud compute instances list | grep gvis-nadklinux >> 003_gcpLog.log"
wait gvis_wS1
sendln "echo '------ Start gcp ------' >> 003_gcpLog.log ; gcloud compute instances start gvis-nadklinux >> 003_gcpLog.log"
wait gvis_wS1
sendln "sleep 10 ; echo '------after Start status ------' >> 003_gcpLog.log ; gcloud compute instances list | grep gvis-nadklinux >> 003_gcpLog.log"
wait gvis_wS1
sendln "exit"
:end
|
google cloudの操作をするためには事前に、ローカルlinuxにgcloudコマンドが使える環境を作成し(google-cloud-sdkをdnfしておく)、google cloud上に作成したプロジェクトと紐付けておくこと。