#! /bin/bash

read -s -p "please input root password:" root_pwd
echo -e "\n"
root_pwd=$(perl -e 'print quotemeta shift(@ARGV)' "${root_pwd}")

expect <<END
        spawn sudo bash /tmp/restart_odae_fi.sh
        set timeout 60
        expect {
            "*assword*" {send "$root_pwd\r"}
        }
        set timeout -1
        expect eof

        catch wait ret
        set exit_status [lindex \$ret 3]
        exit \$exit_status
END
