Benches macOS

8

rsyncd plist for launchd -- not starting …

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I have a plist in /Library/LaunchDaemons which starts an rsync deamon. That is, it starts an rsync daemon if I start it manually with sudo launchctl load rsyncd.plist.

But when I reboot the server and try to connect to the deamon I get (on the client machine)

rsync: server sent "launchproxy[1928]: execv(): No such file or director" rather than greeting

I have to manually reload the launch daemon on the server machine using using

sudo launchctl unload /Library/LaunchDaemons/rsyncd.plist

sudo launchctl load /Library/LaunchDaemons/rsynd.plist

Any ideas? Here is my rysncd.plist, I mostly copied it from an example on the interwebs.

<?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>Disabled</key>

<false/>

<key>Label</key>

<string>rsync</string>

<key>Program</key>

<string>/opt/local/bin/rsync</string>

<key>ProgramArguments</key>

<array>

<string>/opt/local/bin/rsync</string>

<string>--daemon</string>

</array>

<key>inetdCompatibility</key>

<dict>

<key>Wait</key>

<false/>

</dict>

<key>Sockets</key>

<dict>

<key>Listeners</key>

<dict>

<key>SockServiceName</key>

<string>rsync</string>

<key>SockType</key>

<string>stream</string>

</dict>

</dict>

</dict>

</plist>

8 replies

Sign in or join Beachball Help to reply.

  1. 0

    Camelot

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    There are several problems with your .plist, so it's hard to know which one is causing the problem.

    For one you have both a
    Program and a
    ProgramArguments key, when you should have only one or the other (you use
    Program if there is just one element to the command, or
    ProgramArguments if there are multiple.

    Beyond that, though, it's not clear which execution model you're trying to use.
    launchd can run tasks either
    on demand (i.e. when some event happens that triggers the process to launch) or continuously (where launchd watches the process and automatically restarts it if it fails).

    The fact you're specifying network sockets would normally indicate that you're running on demand (i.e. launchd should start rsync whenever an incoming network connection is detected). However, your
    ProgramArguments includes a --daemon parameter to rsync, which tells it to run continuously and listen for network connections itself. These options are incompatible (i.e. either launchd
    or rsync can listen to the network, but not both).

    You should decide which model to employ - either let
    launchd listen to the network and run rsync as needed, or run rsync as a daemon and let it listen to the network.

    As I said above, it isn't clear which (if either) of these is the root cause of your problem, but they need to be fixed before any more debugging can take place.

  2. 0

    jabraham

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Ok that helps a lot, thanks.

    I'll remove the Program part and just use ProgramArguments.

    I think I'd like to use rsync's own daemon capability, with --daemon. I'm familiar with it, and it seems to work reliably once started (at least on my unix boxes). So I should remove the network sockets part, and maybe add a keepalive part?

    I thought a read somewhere about some parameter to launchd that tells the program to start
    after all the network services are started. Do I need something like that? Or am I mis-remembering?

    --

    John

  3. 0

    Camelot

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I think I'd like to use rsync's own daemon capability, with --daemon. I'm familiar with it, and it seems to work reliably once started (at least on my unix boxes). So I should remove the network sockets part, and maybe add a keepalive part?

    If that's the way you want to go, then sure. 🙂

    I thought a read somewhere about some parameter to launchd that tells the program to start after all the network services are started. Do I need something like that? Or am I mis-remembering?

    There is no specific dependency model in
    launchd, but there are some
    KeepAlive options that might help - specifically the
    NetworkState key which will keep your process running as long as there's an active network connection, and shut it down when the network is offline.

    <key>KeepAlive</key>

    <dict>

    <key>NetworkState</key>

    <true/>

    </dict>

  4. 0

    jabraham

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I'm trying this. Much simpler, might work:

    <?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>Disabled</key>

    <false/>

    <key>Label</key>

    <string>rsync</string>

    <key>ProgramArguments</key>

    <array>

    <string>/opt/local/bin/rsync</string>

    <string>--daemon</string>

    </array>

    <key>KeepAlive</key>

    <true/>

    <key>RunAtLoad></key>

    <true/>

    </dict>

    </plist>

  5. 0

    jabraham

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    That new simplified didn't work. I still get

    rsync: server sent "launchproxy[2620]: execv(): No such file or directory" rather than greeting

    as an error trying to connect to the daemon from another machine after rebooting the server. On the server I have to do

    sudo launchctl unload /Library/LaunchDaemons/rsyncd.plist; sudo launchctl load /Library/LaunchDaemons/rsyncd.plist

    after every reboot, before it will work.

    --

    John

  6. 0

    jabraham

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Just to follow up, this seems to be working now. Here is my plist:

    <?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>Disabled</key>

    <false/>

    <key>Label</key>

    <string>rsync</string>

    <key>ProgramArguments</key>

    <array>

    <string>/opt/local/bin/rsync</string>

    <string>--daemon</string>

    </array>

    <key>KeepAlive</key>

    <dict>

    <key>SuccessfulExit</key>

    <false/>

    </dict>

    <key>RunAtLoad></key>

    <true/>

    </dict>

    </plist>

  7. 0

    Aaron Adams

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I'm not sure that I remember the exact wording, but I believe launchd cannot start processes that detach from the terminal (?) they spawn from. (Someone please correct me if I have this description wrong.) Because of that, rsync can't be daemonized from launchd. You'll have to create a StartupItem for it. Looking at my own servers, I see IPFailover, QuickTimeStreamingServer, and SiCoreService all still require StartupItems.

  8. 0

    jabraham

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    The plist above does seem to be working now. On Snow Leopard Server.