0

I am trying to do this :

When " BCKUNIVERSITA " partition on external USB HD mounts , LAUNCHD launches " backup.com " Through backup.com an encrypted DMG ( " riassunti.sparsebundle " ) inside " BCKUNIVERSITA " is mounted . Then with rsync files inside the directory " /DATI/UNIVERSITA " are copied inside mounted dmg " riassunti.sparsebundle " .

here is the code about LaunchD plist :

`<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
        <string>com.rsync.backup</string>
    <key>LowPriorityIO</key>
    <true/>
    <key>Program</key>
        <string>/Users/ikar0/Library/Scripts/backup.com</string>
    <key>ProgramArguments</key>
    <array>
        <string>backup.com</string>
    </array>
    <key>WatchPaths</key>
    <array> 
        <string>/Volumes</string> 
    </array>
</dict>
</plist>`

Here is the code inside " backup.com " :

#!/bin/bash
    folderToBackup="/Volumes/DATI/UNIVERSITA" 
    backupVolume="/Volumes/BCKUNIVERSITA" 
    backupTo="/Volumes/RIASSUNTI/" 
    # mounts encrypted image 
    echo -n 465tyu567 | hdiutil attach -stdinpass /Volumes/BCKUNIVERSITA/riassunti.sparsebundle 
    sleep 10
    if [ ! -e ${backupVolume} ] 
    then echo -n "[*]-- BackupVolume NOT connected - Exiting" | logger exit 0 
    else echo -n "[*]-- BackupVolume Connected - Continuing" | logger 
    fi
    # Copy the files over. Here we are using rsync. 
    for i in ${folderToBackup} 
    do 
    echo -n "[*]-- Starting Rsync of ${i} to ${backupTo}" | logger 
    rsync -aq $folderToBackup $backupTo
    echo -n "[*]-- rsync of ${i} to ${backupTo} complete..."| logger 
    done 
    # once the rsync is done, unmount the drive. 
    hdiutil detach $backupTo 
    exit 0

Here are the errors from console :



16/06/12 01.13.51   com.rsync.backup[14139] rsync: recv_generator: mkdir "/Volumes/RIASSUNTI/UNIVERSITA" failed: Permission denied (13)
16/06/12 01.13.51   com.rsync.backup[14139] *** Skipping everything below this failed directory ***
16/06/12 01.13.51   com.rsync.backup[14139] rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-40/rsync/main.c(992) [sender=2.6.9]
16/06/12 01.13.51   com.rsync.backup[14139] hdiutil: detach failed - Nessun documento o directory esistente
16/06/12 01.13.56   com.rsync.backup[14271] /dev/disk3              GUID_partition_scheme           
16/06/12 01.13.56   com.rsync.backup[14271] /dev/disk3s1            EFI                             
16/06/12 01.13.56   com.rsync.backup[14271] /dev/disk3s2            Apple_HFS                       /Volumes/RIASSUNTI 1
16/06/12 01.14.06   com.rsync.backup[14271] rsync: recv_generator: mkdir "/Volumes/RIASSUNTI/UNIVERSITA" failed: Permission denied (13)
16/06/12 01.14.06   com.rsync.backup[14271] *** Skipping everything below this failed directory ***
16/06/12 01.14.06   com.rsync.backup[14271] rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-40/rsync/main.c(992) [sender=2.6.9]
16/06/12 01.14.06   com.rsync.backup[14271] hdiutil: detach failed - Nessun documento o directory esistente
ikar0
  • 1
  • 1

1 Answers1

0

The error message is saying that the user running rsync does not have permission to do

mkdir "/Volumes/RIASSUNTI/UNIVERSITA"

You may want to set up your sudoers file so that you can change:

rsync -aq $folderToBackup $backupTo

to

sudo rsync -aq $folderToBackup $backupTo
Allen Supynuk
  • 144
  • 1
  • 4