Last active
August 29, 2015 14:17
-
-
Save paulbellamy/01048c737d6bc4673ebf to your computer and use it in GitHub Desktop.
git annex assistant rc.d script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/rc.conf | |
... | |
git_annex_enable="YES" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A pretty inelegant rc.d script for git-annex assistant.