Hey
My cron job to backup shares keeps failing:
It keeps saying...
mkdir: cannot create directory `/mnt/usbdrive/backups/20100202': Permission deni
ed
but I DO have permission with my user pmalbrough
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/pmalbrough>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=pmalbrough>
X-Cron-Env: <USER=pmalbrough>
I run mkdir /mnt/usbdrive/backups/20100202 from the shell prompt and it works fine!
I even went so far as to put the user pmalbrough in the group root.
$groups
root IT
#Here is the permissions for the "backups" dir on /mnt/usbdrive
ls -l
total 8
drwxrwxr-x 4 root root 4096 Feb 3 10:45 backups
and here is my script:
Code:
#! /bin/bash
echo Backup Started `date` >> ~/backuplog
mkdir /mnt/usbdrive/backups/`date +%Y%m%d`
tar -czf /media/disk/backups/`date +%Y%m%d`/home_drive.tar.gz /home
tar -czf /media/disk/backups/`date +%Y%m%d`/Software.tar.gz /shares/samba/softwa
re
tar -czf /media/disk/backups/`date +%Y%m%d`/Public.tar.gz /ahd/test_restores/01-
22-09/public
echo Backup Completed `date` >> ~/backuplog