Posted to tcl by Marko at Wed Jun 29 15:43:38 GMT 2022view raw
- #!/usr/bin/tclsh
- package require Tcl 8.6
- package require Tclx
- signal error sigint
- try {
- # set rc [system $run_cmd]
- # if {$rc == 0} {
- # puts "OK"
- # } else {
- # puts "Nope"
- # }
- if { [catch {set pid [exec -ignorestderr ssh dante rsync -av --progress /home/dante/test1 /home/dante/test2 >@ stdout &]} ]} {
- puts stderr "ERROR: Command failed"
- exit 3
- }
- wait
- } trap {POSIX SIG SIGINT} {} {
- # SIGHUP SIGKILL SIGTERM SIGQUIT SIGSTOP
- puts ""
- puts "Killing pid: $pid"
- kill $pid
- }
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