Created
July 17, 2015 19:09
-
-
Save jevonearth/20296a4213826040b624 to your computer and use it in GitHub Desktop.
freebsd rc scripts and env(1) shebang are not friends
This file contains hidden or 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 | |
# Create dummy python script which uses env for shebang. | |
cat << EOF > /usr/local/bin/foo | |
#!/usr/bin/env python2.7 | |
print("Hello foo") | |
EOF | |
# turn on executable bit | |
chmod +x /usr/local/bin/foo | |
# create FreeBSD rc script with command_interpreter specified. | |
cat << EOF > /usr/local/etc/rc.d/foo | |
#!/bin/sh | |
# | |
# PROVIDE: foo | |
. /etc/rc.subr | |
name="foo" | |
rcvar=foo_enable | |
command_interpreter="/usr/local/bin/python2.7" | |
command="/usr/local/bin/foo" | |
load_rc_config \$name | |
run_rc_command \$1 | |
EOF | |
# turn on executable bit | |
chmod +x /usr/local/etc/rc.d/foo | |
# enable foo | |
echo "foo_enable=\"YES\"" >> /etc/rc.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment