Posted to tcl by Marko at Wed Jun 29 15:43:38 GMT 2022view raw

  1. #!/usr/bin/tclsh
  2. package require Tcl 8.6
  3. package require Tclx
  4.  
  5. signal error sigint
  6.  
  7. try {
  8. # set rc [system $run_cmd]
  9. # if {$rc == 0} {
  10. # puts "OK"
  11. # } else {
  12. # puts "Nope"
  13. # }
  14. if { [catch {set pid [exec -ignorestderr ssh dante rsync -av --progress /home/dante/test1 /home/dante/test2 >@ stdout &]} ]} {
  15. puts stderr "ERROR: Command failed"
  16. exit 3
  17. }
  18. wait
  19.  
  20. } trap {POSIX SIG SIGINT} {} {
  21. # SIGHUP SIGKILL SIGTERM SIGQUIT SIGSTOP
  22. puts ""
  23. puts "Killing pid: $pid"
  24. kill $pid
  25. }

Comments

Posted by Marko at Wed Jun 29 16:25:31 GMT 2022 [text] [code]

Well, this was quite simple. This will handle Ctrl+C and stuff...: package require Tcl 8.6 package require Tclx system ssh -t dante2 rsync -av --progress /home/dante/test1 /home/dante/test2