Home Forums OS X Server and Client Discussion Questions and Answers Launchd not running back-up script – help needed

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #362804
    jgmoore
    Participant

    Hi all, this forum is a last resort before the Xserve gets bypassed, hence any suggestions gratefully accepted.

    Basically, a script which runs ok manually is not being run when called from a plist loaded into launchd, The details are:

    RemoteBakup.plist residing in /System/Library/LaunchDaemons
    The formatting is correct, the parameters only are displayed:
    ———————————————————–

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
            <key>Label</key>
            <string>SPHRemoteBackup</string>
            <key>LowPriorityIO</key>
            <true/>
            <key>Nice</key>
            <integer>1</integer>
            <key>ProgramArguments</key>
            <array>
                    <string>/Users/lad/bakup.sh</string>
            </array>
            <key>StartCalendarInterval</key>
            <dict>
                    <key>Hour</key>
                    <integer>10</integer>
                    <key>Minute</key>
                    <integer>22</integer>
            </dict>
    </dict>
    </plist>
    
    

    ———————————————————–
    This is loaded using:
    Launchctl load -w RemoteBakup.plist
    and then appears in the Launchctl list

    bakup.sh residing in /Users/lad/
    -rwxr-xr-x 1 lad lad 1751 Aug 16 10:17 bakup.sh
    ———————————————————–

    #!/bin/sh

    # Backup script
    # Date: july 2005

    # FIRST create the mount point
    #mkdir /Volumes/RemoteBakups

    # SECOND mount the target share volume for the back-up
    #mount_smbfs -N -U username //Name/RemoteBakups$ /Volumes/RemoteBakups
    # the U flag is used to specify the particular user we want to log in as ie: username
    # uses the N flag to specify that any missing info can be found in the .nmbcrs file
    # the .nmbcrs file contains the ip address etc of the server and the password in encrypted form,
    # encrypted using smbutil
    # .nsmbrc location is in the users home directory. we initally tried using root so /private/var/root
    # now trying local admin home directory
    # /Volumes/RemoteBakups is the node or mount point, ie the point in the file system to
    # begin including the share, this can actually be anywhere
    # NB. decided not to use due to following error message and lack of encryption
    #mount_afp afp://username:password@url/RemoteBakups$ /Volumes/RemoteBakups
    #mount_afp: the mount flags are 0000 the altflags are 0020
    #mount_afp: AFPMountURL returned error -5002, errno is -5002

    # THIRD copy the files from source to target
    #ditto /Volumes/path /Volumes/RemoteBakups/path/
    cp /Volumes/path/* /Volumes/RemoteBakups/path/
    # from 10.4 ditto copies resource forks by default,
    # so the -rsrc flag is unneccesary, this is probably not an issue for filemaker files however
    # FOURTH unmount the target share volume
    #umount -f /Volumes/RemoteBakups
    #rm -rf /Volumes/RemoteBakups
    #the -f option forces the unmount, without this you get a ‘resource busy error’, possibly due to the finder??
    ———————————————————–
    As you can see, at this point for testing purposes, we are mounting the volume manually prior to loading the plist so the shell script is currently only meant to copy the relevant files, and yet even this is still not working.

    The script works when run manually from the command line.
    We have tried to use cron as an alternative,
    cron would copy the files if the destination was mounted, but would not successfully mount the volume
    ———————————————————–
    Any suggestions would be greatly appreciated!!

    #365928
    tcomputerchip
    Participant

    your mount looks like it contains a $ sign in the mount at the top. I don’t see this in the rest of your script. If you are trying to mount a drive that has admin access through smb, e.g. D$ or E$, the $ sign may need an escape charactor.

    #mount_smbfs -N -U username //Name/RemoteBakups\$ /Volumes/RemoteBakups

    Not sure that this is the problem though.

    Regards,

    #365929
    tcomputerchip
    Participant

    your mount looks like it contains a $ sign in the mount at the top. I don’t see this in the rest of your script. If you are trying to mount a drive that has admin access through smb, e.g. D$ or E$, the $ sign may need an escape charactor.
    [code]
    #mount_smbfs -N -U username //Name/RemoteBakups”backslash with out quotes”$ /Volumes/RemoteBakups
    [/code]
    Not sure that this is the problem though.

    Regards,

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Comments are closed