[tahoe-dev] Have some startup and maintenance facilities (was Re: erasure coding makes files more fragile, not less)
Kevin Reid
kpreid at switchb.org
Thu Mar 29 01:13:28 UTC 2012
On Mar 28, 2012, at 16:54, Brian Warner wrote:
> We need better OS-integration code to make it easy to get a server to come up on each reboot. On OS-X that means a LaunchAgent or something.
LaunchDaemon. A LaunchAgent is per GUI-login session, a LaunchDaemon is global. This goes in /Library/LaunchDaemons/org.tahoe-lafs.tahoe.plist (or other appropriate reverse-DNS identifier, with matching Label value):
<?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>GroupName</key>
<string>staff</string>
<key>Label</key>
<string>org.tahoe-lafs.tahoe</string>
<key>OnDemand</key>
<false/>
<key>Disabled</key>
<false/>
<key>UserName</key>
<string>tahoe</string> <!-- adjust to appropriate existant user -->
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/tahoe</string> <!-- adjust to install path -->
<string>run</string>
<string>--basedir=/Users/tahoe/.tahoe</string> <!-- adjust to appropriate user/basedir -->
</array>
<key>EnvironmentVariables</key>
<dict>
<key>LC_CTYPE</key>
<string>en_US.UTF-8</string>
</dict>
</dict>
</plist>
Note the use of "tahoe run", as a LaunchDaemon must *not* daemonize itself or it will appear to have died and be in need of restarting.
> I've been saying forever that it's too hard/slow/inconvenient to get periodic repair to run automatically (cron jobs are soo gross, and suffer from the same energy-barrier problem).
Don't know what's wrong with cron jobs. crontab -e, add a line, done.
30 2 * * * ~/bin/tahoe-repair-all
#!/bin/sh
export LC_CTYPE=en_US.UTF-8
perl -e 'sleep rand() * 86400'
for item in `tahoe list-aliases | cut -f 1 -d :`; do
echo '*** '"$item"
tahoe deep-check --repair --add-lease $item: | perl -pe 's/^/\t/'
echo
done
These are the tools I use. I would be pleased if these, equivalents, or improvements were included with Tahoe instead of being my private tools.
--
Kevin Reid <http://switchb.org/kpreid/>
More information about the tahoe-dev
mailing list