2020-02-25 11:28:31 -08:00
|
|
|
# Copyright (c) 2018-2020, diyIT.org
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# BSD 2-Clause License ("Simplified BSD License" or "FreeBSD License")
|
|
|
|
# https://diyit.org/license/
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# the two lines below are not just comments but required by rcorder; service -e
|
|
|
|
# PROVIDE: cpsserver
|
|
|
|
# REQUIRE: NETWORKING DAEMON
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
: ${cpsserver_enable="NO"}
|
|
|
|
|
|
|
|
name=cpsserver
|
|
|
|
rcvar=${name}_enable
|
|
|
|
|
2020-04-11 00:46:09 -07:00
|
|
|
CPSSERVER="nohup /usr/local/bin/python3.7 /data/calibre-web/cps.py"
|
2020-02-25 11:28:31 -08:00
|
|
|
|
|
|
|
start_cmd="${name}_start"
|
|
|
|
stop_cmd="${name}_stop"
|
|
|
|
restart_cmd="${name}_restart"
|
|
|
|
|
|
|
|
cpsserver_start()
|
|
|
|
{
|
|
|
|
$CPSSERVER -p /data/big/app.db -g /data/big/gdrive.db &
|
|
|
|
$CPSSERVER -p /data/fiction/app.db -g /data/fiction/gdrive.db &
|
|
|
|
$CPSSERVER -p /data/movie/app.db -g /data/movie/gdrive.db &
|
|
|
|
}
|
|
|
|
|
|
|
|
cpsserver_stop()
|
|
|
|
{
|
|
|
|
ps ax | grep -ie cps.py | grep -v grep | awk '{print $1}' | xargs kill -9
|
|
|
|
}
|
|
|
|
cpsserver_restart()
|
|
|
|
{
|
|
|
|
cpsserver_stop
|
|
|
|
cpsserver_start
|
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config ${name}
|
|
|
|
run_rc_command "$1"
|