Skip to content

Instantly share code, notes, and snippets.

@paulbellamy
Last active August 29, 2015 14:17
Show Gist options
  • Save paulbellamy/01048c737d6bc4673ebf to your computer and use it in GitHub Desktop.
Save paulbellamy/01048c737d6bc4673ebf to your computer and use it in GitHub Desktop.
git annex assistant rc.d script
#!/bin/sh
# /etc/rc.d/git_annex
# PROVIDE: git_annex
# REQUIRE: LOGIN FILESYSTEMS NETWORKING
# KEYWORD: shutdown
. /etc/rc.subr
name="git_annex"
rcvar=`set_rcvar`
start_cmd="git_annex_start"
stop_cmd="git_annex_stop"
load_rc_config $name
git_annex_start()
{
if checkyesno ${rcvar}; then
export HOME=/root
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
git annex assistant --autostart
fi
}
git_annex_stop()
{
if checkyesno ${rcvar}; then
pid=`ps aux | grep "[g]it-annex assistant" | head -n1 | awk '{print $2}'`
if [ "$pid" != "" ]; then
kill $pid
fi
fi
}
run_rc_command "$1"
# /etc/rc.conf
...
git_annex_enable="YES"
@paulbellamy
Copy link
Author

A pretty inelegant rc.d script for git-annex assistant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment