期望脚本不能从cron工作,从命令行工作

时间:2016-02-25 20:04:53

标签: linux cron expect

此处观察到的脚本和消息:

[root@server01 ~]# cat /usr/local/scripts/rsync.exp
#!/usr/bin/expect 
eval spawn rsync -av --delete /backup/ root@server02:/backup  
;#use correct prompt
set prompt ":|#|\\\$"
interact -o -nobuffer -re $prompt return
send "welcome123\r"
interact -o -nobuffer -re $prompt return
send "pwd"
interact -o -nobuffer -re $prompt return
expect "#"
expect eof
[root@server01 ~]# 

expect: spawn id exp4 not open
    while executing
"expect "#""
    (file "/usr/local/scripts/rsync.exp" line 13)
[root@server01 ~]# 

当我在命令行使用ctrl + d终止时,我看到上面的错误。

0 个答案:

没有答案