Ulrich,

  Hi.

On 2002.02.01, at 21:02, Ulrich auf dem Keller wrote:
> thanks for providing information on the useful psync command. I already 
> tried it successfully for backups of entire partitions with a firewire 
> drive as target directory. Since I would like to use it routinely on 
> our institute MacOS X server I tried to include it into the root 
> crontab file. Therefore I wrote a small script that only includes the 
> path to psync and the psync command itself (I am a quite UNIX newbie).

   The problem was simple after all.  See below.

> When I run the script as root from the command line being logged in as 
> administrator and using sudo everything goes fine except that the 
> finder is not able to display the icons before I logout and login again 
> (this is no problem for me since I see everything correctly when 
> browsing in the terminal). But when the cron job runs while nobody is 
> logged in some files and directories are missing in the backup. Do you 
> have any idea what is going wrong ?

   As for the icons psync does not backup Desktop (DB|DF) so simple 
desktop rebuilding will fix it (I deliberately did so but this can be 
altered very easily.  Future version may include commandline switch to 
control which files/directories to ignore).
   And now for the cron

> Here is the little script for running psnyc:
>
> #!/bin/sh -
> #
> PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
>
> sudo psync /Volumes/Data /Volumes/d-backup

   No.  the trick is that you can't use sudo in cron.  Remember you have 
to type in your password before you 'initialize' sudo?  Anything that 
demands tty (that is, Terminal or any interactive commandline interface) 
will fail in cron.  So here is what you should do in the script.  And 
since you are already running as root via cron, there is no point 
sudoing;

#!/bin/sh

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin ; export PATH

psync  /Volumes/Data /Volumes/d-backup > /var/tmp/psync.out 2>&1

# put all output to /var/tmp/psync.out
#end

> and here my crontab entry:
>
> 15      1      *       *       *       root    sh /etc/backuptest

This can stay as is.

Dan

Reply via email to