direwolf start-up script

Actually direwolf has one called dw-start.sh. but in my opinion the script was too compilcated for me(i don’t know with someone else).
so i’ve created very simple script.

#!/bin/bash
SERVICE="direwolf"
if pgrep -x "$SERVICE" >/dev/null
then
    echo "$SERVICE is running"
    exit 0
else
    screen -dmS direwolf /usr/local/bin/direwolf -c /home/hari/direwolf.conf -t 0 -X 1 -d ii -d ffff  -T '%F %T'
fi

save it as direwolf.sh and,

chmod 755 direwolf.sh

explaination:

SERVICE="direwolf"

linux process name for direwolf.

direwolf’s service.

hari@APRS ~ $ ps ax | grep direwolf | grep -v grep
 841420 ?        Ss     0:04 SCREEN -dmS direwolf /usr/local/bin/direwolf -c /home/hari/direwolf.conf -t 0 -X 1 -d ii -d ffff -T %F %T
 841421 pts/3    Ssl+ 211:11 /usr/local/bin/direwolf -c /home/hari/direwolf.conf -t 0 -X 1 -d ii -d ffff -T %F %T
hari@APRS ~ $ 

next

if pgrep -x "$SERVICE" >/dev/null

it’s translated as if pgrep -x direwolf

hari@APRS ~ $ pgrep -x direwolf
841421
hari@APRS ~ $

that command will returning pid as a result
if conditional check will test, if retuns pid conditional check will exit immediately.
if no pid execute

screen -dmS direwolf /usr/local/bin/direwolf -c /home/hari/direwolf.conf -t 0 -X 1 -d ii -d ffff  -T '%F %T'

i run the script in cronjob every 1 minute

* * * * * /home/hari/direwolf.sh

that’s all
very simple direwolf startup script

enjoy 73

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *