linux - Automate the end of a script that waits for you to press ENTER -


i'd able use cron automate execution of copyconsole, program performs synchronization of files on server's copy.com

the problem execution not terminates while enter key not pressed.

i've tried various forms of script, best of this, without success:

#!/bin/bash  timeout=600  expect() {    local expect="$1" send="$2"    local delim="${expect:(-1):1}"    local buffer="" block=""    while read -u3 -r -t$timeout -d "$delim" block;       buffer="$buffer$block$delim"       case "$buffer" in          *"$expect")             echo "$send" 1>&3             return             ;;       esac    done }  exec 3<>/usr/local/copy.com/copy_sync.sh expect "all files date" "\r" 

can me find solution, please? thanks!

solved!

have use "#!/usr/bin/expect" , execute "spawn"

#!/usr/bin/expect  set timeout 600 spawn /usr/local/copy.com/x86_64/copyconsole -u=mail@copyaccount -r=/var/backups/copy.com -p=password expect "all files date" { send "\r"} 

thanks comments.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -