-
-
Notifications
You must be signed in to change notification settings - Fork 160
Create Anubis FreeBSD rc.d script #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
|
||
# PROVIDE: anubis | ||
# REQUIRE: NETWORKING | ||
# KEYWORD: shutdown | ||
|
||
. /etc/rc.subr | ||
|
||
name=anubis | ||
rcvar=a 8000 nubis_enable | ||
|
||
load_rc_config ${name} | ||
|
||
: ${anubis_enable="NO"} | ||
: ${anubis_user="anubis"} | ||
: ${anubis_bin="/usr/local/bin/anubis"} | ||
: ${anubis_environment_file="/etc/anubis.env"} | ||
|
||
command=/usr/sbin/daemon | ||
procname=${anubis_bin} | ||
pidfile=/var/run/anubis.pid | ||
logfile=/var/log/anubis.log | ||
command_args="-c -f -p ${pidfile} -o ${logfile} ${procname}" | ||
start_precmd=anubis_precmd | ||
|
||
anubis_precmd () { | ||
export $(xargs < ${anubis_environment_file}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From man 8 rc.subr:
Might that be useful to you? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Useful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be clear, I have not tried
No. I think the use of
From what I see, this should allow both, for example, the following two line in e.g.
where:
Users can use either or a combination of both. Testing would reveal if specifying the same VAR in both places indicates a precedence (e.g. that one approach always overrides the other). At present, I am using the
When started, I get this:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great, thanks. This makes sense. I'll do some testing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is good stuff. I've tested and each variable can work with the other Looking nice! |
||
if [ ! -f ${logfile} ]; then | ||
install -o anubis /dev/null ${logfile} | ||
fi | ||
install -o anubis /dev/null ${pidfile} | ||
} | ||
|
||
run_rc_command "$1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this where stdout/stderr is written?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, correct.
The daemon command has a
-o
flag which can write the output to a log file.https://man.freebsd.org/cgi/man.cgi?daemon(8)