I’m trying to write a shred script to output the files deleted to text file but I think I’m doing something wrong with the output? I was also thinking of adding a email section to the script to email confirmation when all files have been deleted but first things first need to get the output working to a text file.
Thanks
#!/bin/bash
# Use on remote server
LOCATION="/home/user/Test"
TIMES=-n38
cd $LOCATION
# Delete all files in location 30 times
echo "Deleting all delete located at $LOCATION "
nohup find $LOCATION -exec shred $TIMES -u '{}' \; & >> /home/user/output.txt
echo "All data at $LOCATION has been shredded $TIMES times"
# Delete the partition
#nohup shred -n 30 -vz /dev/sdb1 &
The ampersand needs to be at the end of the command, after the stdout redirection: