I'm working out a little script to be launched as a cron job that will move some syslog files, compress, and archive them.
Code:
#!/bin/bash
# Script to move logs over 14 days old to a backup folder, then archive them comressed.
TIME=`date +"%b-%d-%y"`
FILENAME="archive-$TIME.tar"
find /var/opt/syslog/* -mtime +14 -exec mv -v {} /var/opt/backup \;
tar -cvfj /var/opt/archive/$FILENAME /var/opt/backup/*
When I run this in a file, I get an error complaining about
Code:
find: missing argument to `-exec'
However, if I enter each line in bash, everything works fine without error.
Can anyone figure out why I'm getting the error with find?