Is it possible in bash to finish command piped through gzip gracefully? -
i have startup script calls command produces lot of output. preserve space gzipped output:
#!/bin/bash my_command 2>&1 | tee >(gzip --stdout > "1.log.gz")
sadly, when press ctrl+c, gzip
stops abruptly , compressed log gets damaged. there way finish command gracefully valid gz?
i unable reproduce problem, using "yes" substitute program -- is
yes 2>&1 | tee >(gzip --stdout > "1.log.gz")
created valid gz file every time, wondering if there else going on.
however can isolate 2 parts of command using named pipes, this;
# create named pipe mknod mypipe p # start background job reads pipe gzip --stdout > "1.log.gz" <mypipe & # work -- ctrl-c affect process my_command 2>&1 | tee mypipe
Comments
Post a Comment