Permalink
Browse files

Add supervisorctl config file

  • Loading branch information...
root
root committed Oct 18, 2018
1 parent 9bc78ee commit 89682542d2274f38b4368d6c76900c816d307000
Showing with 67 additions and 10 deletions.
  1. +2 −1 README.md
  2. +32 −0 assets/supervisord.conf
  3. +3 −0 config.default.yml
  4. +30 −9 run.sh
@@ -40,7 +40,7 @@ OSFW includes 3 main components:

Install the dependencies with your package manager (for example `apt` on Ubuntu or `yum` on Fedora):

apt install python3 virtualenv iptables unbound systemd screen
apt install python3 virtualenv iptables unbound systemd supervisor screen

Install the virtual environment:

@@ -138,6 +138,7 @@ There is a way to perform a subdomain wildcard, to do so you need to use a `*?`
- iptables
- unbound
- systemd
- supervisor
- screen
- nginx
- ssl-cert
@@ -0,0 +1,32 @@
[program:osfw-sensor]
user=root
directory=/root/osfw
command=/root/osfw/run.sh daemon/sensor
stdout_logfile=/var/log/osfw-sensor.out
stderr_logfile=/var/log/osfw-sensor.err
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true

[program:osfw-syncfw]
user=root
directory=/root/osfw
command=/root/osfw/run.sh daemon/syncfw
stdout_logfile=/var/log/osfw-syncfw.out
stderr_logfile=/var/log/osfw-syncfw.err
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true

[program:osfw-webapp]
user=root
directory=/root/osfw
command=/root/osfw/run.sh webapp
stdout_logfile=/var/log/osfw-webapp.out
stderr_logfile=/var/log/osfw-webapp.err
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
@@ -141,6 +141,7 @@ exemptions:
- "*?.icloud.com"
- "*?.iconfinder.com"
- "*?.imageshack.us"
- "*?.imgbox.com"
- "*?.imgur.com"
- "*?.instagram.com"
- "*?.jsfiddle.net"
@@ -173,6 +174,7 @@ exemptions:
- "*?.outlook.com"
- "*?.ovh.com"
- "*?.ow.ly"
- "*?.owncloud.org"
- "*?.pastebin.com"
- "*?.phishtank.com"
- "*?.pinterest.com"
@@ -187,6 +189,7 @@ exemptions:
- "*?.similarcdn.com"
- "*?.similarweb.com"
- "*?.sina.com"
- "*?.smartsheet.com"
- "*?.sohu.com"
- "*?.spamhaus.org"
- "*?.t.co"
39 run.sh 100644 → 100755
@@ -15,17 +15,38 @@ export LC_ALL="C.UTF-8"
export LANG="C.UTF-8"

if [ -z "$1" ]; then
RESULT=`find /var/run/screen -name "*.osfw-sensor"`
if [ -z "$RESULT" ]; then
screen -dmS osfw-sensor python osfw.py daemon/sensor
RESULT=`supervisorctl pid osfw-sensor`
if [ "$RESULT" == 0 ]; then
RESULT=`find /var/run/screen -name "*.osfw-sensor" | wc -l | xargs`
if [ "$RESULT" == 0 ]; then
screen -dmS osfw-sensor python osfw.py daemon/sensor
else
echo "Error: osfw-sensor is already running in a screen"
fi
else
echo "Error: osfw-sensor is already running from supervisor"
fi
RESULT=`find /var/run/screen -name "*.osfw-syncfw"`
if [ -z "$RESULT" ]; then
screen -dmS osfw-syncfw python osfw.py daemon/syncfw
RESULT=`supervisorctl pid osfw-syncfw`
if [ "$RESULT" == 0 ]; then
RESULT=`find /var/run/screen -name "*.osfw-syncfw" | wc -l | xargs`
if [ "$RESULT" == 0 ]; then
screen -dmS osfw-syncfw python osfw.py daemon/syncfw
else
echo "Error: osfw-syncfw is already running in a screen"
fi
else
echo "Error: osfw-syncfw is already running from supervisor"
fi
RESULT=`find /var/run/screen -name "*.osfw-webapp"`
if [ -z "$RESULT" ]; then
screen -dmS osfw-webapp python osfw.py webapp
RESULT=`supervisorctl pid osfw-webapp`
if [ "$RESULT" == 0 ]; then
RESULT=`find /var/run/screen -name "*.osfw-webapp" | wc -l | xargs`
if [ "$RESULT" == 0 ]; then
screen -dmS osfw-webapp python osfw.py webapp
else
echo "Error: osfw-webapp is already running in a screen"
fi
else
echo "Error: osfw-webapp is already running from supervisor"
fi
else
python osfw.py "$1"

0 comments on commit 8968254

Please sign in to comment.