Add FreeBSD service
This commit is contained in:
parent
ae3912299b
commit
83e2095b12
1 changed files with 33 additions and 0 deletions
33
ansible/blog.service
Normal file
33
ansible/blog.service
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# PROVIDE: blog
|
||||||
|
# REQUIRE: LOGIN NETWORKING
|
||||||
|
# KEYWORD: shutdown
|
||||||
|
|
||||||
|
. /etc/rc.subr
|
||||||
|
|
||||||
|
name=blog
|
||||||
|
rcvar="blog_enable"
|
||||||
|
|
||||||
|
load_rc_config $name
|
||||||
|
: ${blog_enable="NO"}
|
||||||
|
: ${blog_listen_addr="0.0.0.0:8000"}
|
||||||
|
|
||||||
|
pidfile="/var/run/${name}.pid"
|
||||||
|
logfile="/var/log/${name}.log"
|
||||||
|
|
||||||
|
blog_env_file="/srv/blog/.env"
|
||||||
|
command_interpreter="/srv/blogvenv/bin/python"
|
||||||
|
command="/srv/blogvenv/bin/gunicorn"
|
||||||
|
blog_flags="-D --chdir /srv/blog -b ${blog_listen_addr} --log-file ${logfile} --pid ${pidfile}"
|
||||||
|
command_args="blog.wsgi"
|
||||||
|
|
||||||
|
start_precmd="${name}_prestart"
|
||||||
|
blog_prestart()
|
||||||
|
{
|
||||||
|
. /srv/blog/.env
|
||||||
|
yes yes | /srv/blogvenv/bin/python /srv/blog/manage.py migrate
|
||||||
|
/srv/blogvenv/bin/python /srv/blog/manage.py collectstatic --noinput --clear
|
||||||
|
}
|
||||||
|
|
||||||
|
run_rc_command "$1"
|
Reference in a new issue