Posted to tcl by funa at Wed Dec 11 12:54:09 GMT 2019view raw

  1.  
  2. #!/usr/local/expect
  3. set DATE [exec date +%Y-%m-%d]
  4. spawn /usr/local/archive.sh archive $DATE /backup/archive
  5. expect
  6. if [[ "Archive all revisions received until $DATE? (yes/no):" ]];then {
  7. send -- "yes"
  8. else
  9. exit 0
  10. }
  11. expect eof
  12.  
  13.  
  14. Output:
  15.  
  16. ./archive
  17. spawn /usr/local/st_archive.sh archive 2019-12-11 /backup/archive/
  18. Preparing...
  19. Date specified is too late. Last revision in the database is from 2019-11-14.
  20. Archiving revisions failed or aborted.
  21. invalid command name "Archive"
  22. while executing
  23. "Archive all revisions received until $DATE? (yes/no): "
  24. invoked from within
  25. "[ Archive all revisions received until $DATE? (yes/no): ]"
  26. invoked from within
  27. "if [[ Archive all revisions received until $DATE? (yes/no): ]]"
  28. (file "./archive" line 5)
  29.  
  30.