Created
December 9, 2010 16:37
-
-
Save squeeks/734937 to your computer and use it in GitHub Desktop.
This is a sample rc script for setting FreeBSD up to boot and fire a Plack application with plackup. Substitute "plack_app" with your own details if you want, and stick this file in /usr/local/etc/rc.d/ after configuring /etc/rc.conf. Other dependant app
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 | |
# | |
# PROVIDE: plack_app | |
# REQUIRE: LOGIN | |
# BEFORE: cron | |
# | |
# Add the following lines to /etc/rc.conf to enable the webapp: | |
# plack_app_enable (bool): Set to "NO" by default. | |
# Set it to "YES" to enable | |
# | |
# plack_app_app (path): Location of the Plack application | |
# Set to "/usr/local/www/plack_app/app.psgi" by default. | |
# | |
# plack_app_server (string): PSGI Server to use. Defaults to HTTP::Server::PSGI. | |
# | |
# plack_app_port (int): TCP Port to start the server on. Default to 5000. | |
# | |
# plack_app_env (string): "production" by deafult, can also accept "development" | |
# | |
. /etc/rc.subr | |
name="plack_app" | |
rcvar=`set_rcvar` | |
[ -z "$plack_app_enable" ] && plack_app_enable="NO" | |
[ -z "$plack_app_app" ] && plack_app_app="/usr/local/www/plack_app/app.psgi" | |
[ -z "$plack_app_server" ] && plack_app_server="HTTP::Server::PSGI" | |
[ -z "$plack_app_port" ] && plack_app_port="5000" | |
[ -z "$plack_app_env" ] && plack_app_env="production" | |
command="/usr/local/bin/plackup" | |
# I don't use --daemonize because it's server dependant | |
command_args=" --server $plack_app_server --port $plack_app_port --env $plack_app_env $plack_app_app &" | |
load_rc_config $name | |
run_rc_command "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment