-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_authority.exp
executable file
·93 lines (82 loc) · 2.1 KB
/
get_authority.exp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/expect
# get_authority.exp
# James Staub
# Nashville Public Library
exp_internal 0 ; # 1 = verbose debugging to stdout
log_user 0 ; # 1 = send screens to stdout
# READ CONFIG.PWD.INI
source read_config.exp
# SET UP LOG
# TO WRITE TO THE LOG:
# logWrite $logFile "log entry"
source log.exp
set logFile "$localPath$name.log"
logWrite $logFile "START get_authority"
# INNOPAC LOG IN
source innopac_login.exp
# AUTHORITY RECORD EXTRACT
expect "A > ADDITIONAL system functions*Choose one*\)"
send "A"
expect "M > Read/write MARC records*Choose one*\)"
send "M"
expect "Please key your initials :"
send "$INNOPACinitials\r"
expect "Please key your password :"
send "$INNOPACinitialsPassword\r"
expect "O > OUTPUT MARC records to another system using tape or FTS*Choose one*\)"
send "O"
expect "C > CREATE file of unblocked MARC records*Choose one*\)"
send "C"
expect "Enter name of file"
send "$name-06\r"
expect "R > from a RANGE of record numbers*Choose one*\)"
send "R"
expect "AUTHORITY*Enter starting record # :"
send "a"
expect "_"
send "\r"
expect "Enter ending record # :"
send "\r"
expect "Is the range correct? \(y/n\)"
send "y"
expect "S > START sending records"
send "S"
set timeout -1
expect "RECORD CONVERSION STATISTICS*Q > QUIT*Choose one*\)"
set timeout $wait
send "Q"
expect "Press <SPACE> to continue"
send " "
expect "Q > QUIT*Choose one*\)"
send "Q"
expect "Press <SPACE> to continue"
send " "
# QUIT here appears on ADDITIONAL options, will time out
expect "Q > QUIT*Choose one*\)"
send "Q"
expect "Q > QUIT*Choose one*\)"
send "Q"
expect "Q > QUIT*Choose one*\)"
send "Q"
close
# RETRIEVE AUTHORITY FILE FROM MILLENNIUM
spawn scp $solarisUser@$host:$solarisPath/$name-06.out $localPath$name-06.mrc
set timeout -1
expect "Password"
send "$solarisUserPassword\r"
expect "100%*\n"
close
set timeout $wait
logWrite $logFile "COMPLETE get_authority"
# SLEEP WHILE FILE WRITES
sleep 10
logWrite $logFile "START format_authority"
set prompt {\$ $}
spawn bash
expect -re $prompt
send "php format_authority.php\r"
set timeout -1
expect -re $prompt
close
set timeout $wait
logWrite $logFile "COMPLETE format_authority"