2019-06-15 23:02:44 +00:00
|
|
|
#!/usr/bin/expect
|
|
|
|
|
|
|
|
set timeout 20
|
|
|
|
|
|
|
|
set tls_cert "/home/bitcoin/.lnd/tls.cert"
|
|
|
|
set macaroon "/home/bitcoin/.lnd/data/chain/bitcoin/mainnet/admin.macaroon"
|
|
|
|
|
2019-07-06 01:45:42 +00:00
|
|
|
set f [open "/mnt/hdd/mynode/settings/.lndpw"]
|
2019-06-15 23:02:44 +00:00
|
|
|
set pw [read $f]
|
|
|
|
|
|
|
|
spawn lncli --tlscertpath $tls_cert --macaroonpath $macaroon unlock
|
|
|
|
expect {
|
|
|
|
"wallet password:" {
|
|
|
|
send -- "$pw\n"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
expect {
|
|
|
|
"Wallet is already unlocked" {
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
eof {
|
|
|
|
lassign [wait] pid spawnid os_error_flag return_code
|
|
|
|
exit $return_code
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exit 99
|