mirror of
https://github.com/owntracks/recorder.git
synced 2026-08-23 11:26:16 +00:00
rhel start script
This commit is contained in:
+11
-10
@@ -6,14 +6,15 @@
|
||||
# absolute path to executable binary
|
||||
exec='/usr/sbin/ot-recorder'
|
||||
|
||||
# Source config
|
||||
if [ -f /etc/sysconfig/$exec ] ; then
|
||||
. /etc/sysconfig/$exec
|
||||
fi
|
||||
|
||||
# Program name
|
||||
prog=$(basename $exec)
|
||||
|
||||
# Source config
|
||||
if [ -f /etc/default/$prog ] ; then
|
||||
. /etc/default/$prog
|
||||
fi
|
||||
|
||||
|
||||
# PID file
|
||||
pidfile="/var/run/${prog}.pid"
|
||||
|
||||
@@ -32,26 +33,26 @@ eval_cmd() {
|
||||
|
||||
start() {
|
||||
# see if running
|
||||
local pids=$(pgrep $prog)
|
||||
local pids=$(pgrep -f $exec)
|
||||
|
||||
if [ -n "$pids" ]; then
|
||||
echo "$prog (pid $pids) is already running"
|
||||
return 0
|
||||
fi
|
||||
printf "%-50s%s" "Starting $prog: " ''
|
||||
$exec $opts &
|
||||
$exec $OTR_TOPICS &
|
||||
|
||||
# save pid to file if you want
|
||||
echo $! > $pidfile
|
||||
|
||||
# check again if running
|
||||
pgrep $prog >/dev/null 2>&1
|
||||
pgrep -f $exec >/dev/null 2>&1
|
||||
eval_cmd $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
# see if running
|
||||
local pids=$(pgrep $prog)
|
||||
local pids=$(pgrep -f $exec)
|
||||
|
||||
if [ -z "$pids" ]; then
|
||||
echo "$prog not running"
|
||||
@@ -65,7 +66,7 @@ stop() {
|
||||
|
||||
status() {
|
||||
# see if running
|
||||
local pids=$(pgrep $prog)
|
||||
local pids=$(pgrep -f $exec)
|
||||
|
||||
if [ -n "$pids" ]; then
|
||||
echo "$prog (pid $pids) is running"
|
||||
|
||||
@@ -6,3 +6,4 @@ export OTR_PORT="1883"
|
||||
# export OTR_PASS="password"
|
||||
# export OTR_CAFILE="/path/to/tls/CA.crt"
|
||||
export OTR_STORAGEDIR="/var/spool/owntracks/store"
|
||||
export OTR_TOPICS='owntracks/#'
|
||||
|
||||
Reference in New Issue
Block a user