standard out (general output) and standard error (error output) are treated differently. To redirect stderr, you need to use 2>, instead of > Here's an example that should do what you want (note, untested!):
#!/bin/bash RDIFF=rdiff-backup EXCLUDE_LIST=/home/jjj/rdiff_excludes.txt SOURCE=/ DEST=/media/disk2/Full_system_backup ERR_OUT=/home/jjj/rdiff-errors.txt OUT=/home/jjj/rdiff-output.txt STATS=/home/jjj/rdiff-stats.txt $RDIFF --include-globbing-filelist $EXCLUDE_LIST $SOURCE $DEST 2> $ERR_OUT > $OUT $RDIFF --list-increment-sizes $DEST > $STATS Note that you should be able to run this script with "sudo <scriptname>" rather than using sudu within the script (which may stop and ask for a password). --Rogan On Sat, Jun 27, 2009 at 4:16 PM, John Jason Jordan<[email protected]> wrote: > I'm sure this is trivial for most people here, but man bash is massive > and I can't figure it out. > > In an effort to bend rdiff-backup to my will I have created the > following script: > > #!/bin/bash > sudo rdiff-backup --include-globbing-filelist /home/jjj/rdiff_excludes.txt / > /media/disk2/Full_system_backup > /home/jjj/rdiff-errors.txt > sudo rdiff-backup --list-increment-sizes /media/disk2/Full_system_backup > > /home/jjj/rdiff-stats.txt > > > The first line runs the backup. The second line obtains statistics > about the backup. > > When running the backup several error messages are generated. I want > these saved to a file. I also want the statistics in the second line > written to a file. > > The statistics are going to the specified file perfectly. However, the > error messages generated when the backup is run are just being > displayed in a terminal window and not going to the file. When the > script ends the terminal window disappears. taking the error messages > with it. (I can see them if I watch while it is running.) The command > does create the rdiff-errors.txt file, but it has -0- bytes. > > The question is how to modify the "> /home/jjj/rdiff-errors.txt" part > of the first line so it sends the error messages to the file? > _______________________________________________ > PLUG mailing list > [email protected] > http://lists.pdxlinux.org/mailman/listinfo/plug > _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
