On Mon 14 Dec 2009, robert spitzenpfeil wrote: > post-server: cd .. ; find ./tree -type f ! -name > "dirvish_md5sums-on_server.log" -exec md5sum {} \; | cat > > dirvish_md5sums-on_server.log ; ../magic.pl $DIRVISH_SRC ; scp -P 66 > dirvish_md5sums-for_client.log r...@$dirvish_client:/tmp ; ssh -p 66 > r...@$dirvish_client "md5sum -c /tmp/dirvish_md5sums-for_client.log > > /tmp/dirvish_md5sums-for_client.checked" ; scp -P 66 > r...@$dirvish_client:/tmp/dirvish_md5sums-for_client.checked . ; ssh > -p 66 r...@$dirvish_client "rm /tmp/dirvish_md5sums-for_client*"; > find ./ -name "dirvish_md5sums*" -exec gzip {} \;
Argh The problem is that by writing out all the shell commands on one line, is that only the first command will be run in the environment with the DIRVISH_* variables set. The rest of the commands will use the bash environment, which can't use the environment from the first commmand... Hence your proposed patch will help ONLY your situation. People that run a separate command will LOSE the variables! How about throwing all of that into a separate script, e.g. under /etc/dirvish/robertscript or whatever :-) Let's write that out: cd .. find ./tree -type f ! -name "dirvish_md5sums-on_server.log" -exec md5sum {} \; | cat > dirvish_md5sums-on_server.log ../magic.pl $DIRVISH_SRC scp -P 66 dirvish_md5sums-for_client.log r...@$dirvish_client:/tmp ssh -p 66 r...@$dirvish_client "md5sum -c /tmp/dirvish_md5sums-for_client.log > /tmp/dirvish_md5sums-for_client.checked" scp -P 66 r...@$dirvish_client:/tmp/dirvish_md5sums-for_client.checked . ssh -p 66 r...@$dirvish_client "rm /tmp/dirvish_md5sums-for_client*" find ./ -name "dirvish_md5sums*" -exec gzip {} \; First a couple of comments: - command | cat > file Better to do: command > file Why waste a pipe and a process? - find -exec command {} \; Better to do: find -print0 | xargs -0 command This saves a lot of processes. Of course, if there are only a couple of files that are matched then it doesn't matter so much. - find ./tree Why the ./ ? find won't use "tree" anywhere else in the filesystem... Why not ./././././tree ? :-) Of course, perhaps something else in your commands may be expecting the paths to have ./ prepended. So the second line becomes: find tree -type f ! -name dirvish_md5sums-on_server.log -print0 | xargs -0 md5sum > dirvish_md5sums-on_server.log I'd change the last line to: gzip dirvish_md5sums* So put this in your script file: #!/bin/sh -e cd .. find tree -type f ! -name dirvish_md5sums-on_server.log -print0 | xargs -0 md5sum > dirvish_md5sums-on_server.log ../magic.pl $DIRVISH_SRC scp -P 66 dirvish_md5sums-for_client.log r...@$dirvish_client:/tmp ssh -p 66 r...@$dirvish_client "md5sum -c /tmp/dirvish_md5sums-for_client.log > /tmp/dirvish_md5sums-for_client.checked" scp -P 66 r...@$dirvish_client:/tmp/dirvish_md5sums-for_client.checked . ssh -p 66 r...@$dirvish_client "rm /tmp/dirvish_md5sums-for_client*" gzip dirvish_md5sums* Do a chmod +x scriptfile to make it executable. The -e makes the script stop as soon as any command fails, which is usually the safest option. Now put: post-server: /etc/dirvish/scriptfile in the config instead of that whole shebang, and I'm sure those environment variables will exist in that script, without the need to modify dirvish. Paul -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org