help with script
Hi,
i'm writing a script to automate a backup for Scalix mailserver. I'm very basic in writing script so that's why I need some help. I have this already and it works: #!/bin/sh DATE=`date +%d-%m-%y` mkdir /backup/wednesday/ cd /backup/wednesday/ mkdir $DATE sxmboxexp --force --user "user1" -a /backup/wednesday/$DATE/user1.mbox sxmboxexp --force --user "user2" -a /backup/wednesday/$DATE/user2.mbox sxmboxexp --force --user "user3" -a /backup/wednesday/$DATE/user3.mbox exit Actually I want to have a rotation script, but that's too complicated. That's why I thought about automatically removing backups which are older then 7 days old. I thought this command was ok, but apparently not: find /backup/wednesday/ -mindepth 7 -atime 1 rm -R {}\; I get an error message which says: "paths must precedes expression....." I can't solve this error. Please help. Thanks in advance |
Quote:
Code:
find /backup/wednesday/ -mindepth 7 -atime 1 -exec rm -R {}\; |
Quote:
it says: "missing argument to '-exec' " this is the problem i ran into the beginning. |
space between {} and \
|
Quote:
That did the trick. thanks |
Here's a script that I wrote ages ago you just need to edit it a bit, it will backup to a cdrom if you need that as well
Code:
#!/bin/sh |
#!/bin/sh
DATE=`date +%d-%m-%y` BACKUP_DIR=/backup/wednesday mkdir $BACKUP_DIR/$DATE cd $BACKUP_DIR sxmboxexp --force --user "user1" -a $BACKUP_DIR/$DATE/user1.mbox sxmboxexp --force --user "user2" -a $BACKUP_DIR/$DATE/user2.mbox sxmboxexp --force --user "user3" -a $BACKUP_DIR/$DATE/user3.mbox find $BACKUP_DIR/$DATE -mindepth 7 -atime +7 -exec rm -R {} \; exit |
All times are GMT -5. The time now is 07:18 AM. |