rhel start script

This commit is contained in:
Jan-Piet Mens
2015-09-10 13:23:52 +02:00
parent 42358ba914
commit 6d341d68a0
2 changed files with 12 additions and 10 deletions
+11 -10
View File
@@ -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"
+1
View File
@@ -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/#'