Recently a detection script was made and sent logs to the relevant server. The script test is normal, and the log is sent normally, so join crontab
However, it is not possible to execute in crontab. Check the crontab running status, script execution permissions, environment variables, and so on, all normal, the script still cannot execute.
Later found a post, said Scp.exp have a problem
The following are: Scp.exp
#!/usr/bin/expect-f
Set CMD0 [lindex $argv 0]
Set CMD1 [lindex $argv 1]
Set PASS "[Email protected]"
Spawn scp-r $CMD 0 $CMD 1
Set Timeout 10
Expect {
"* (yes/no) *" {send "yes\r"}
"*password*" {send "${pass}\r"}
}
Interact
Finally Scp.exp stays on the interaction, and the password cannot be entered, and has failed. Interaction must be terminated
Modified SCP.EXP Success
Modify the following
#!/usr/bin/expect-f
Set CMD0 [lindex $argv 0]
Set CMD1 [lindex $argv 1]
Set PASS "[Email protected]"
Spawn scp-r $CMD 0 $CMD 1
Expect {
"* (yes/no) *" {send "yes\r"}
"*password*" {send "${pass}\r"}
}
#interact
Set Timeout 20
Expect EOF
Exit
This article is from the "OPS rookie" blog, please be sure to keep this source http://ckl893.blog.51cto.com/8827818/1682295
Crontab Execution Scp.exp failed