-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8864ca
commit 4736317
Showing
3 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Define patchman_pythonpath /usr/lib/python3/dist-packages | ||
WSGIScriptAlias /patchman ${patchman_pythonpath}/patchman/wsgi.py | ||
WSGIPythonPath ${patchman_pythonpath} | ||
|
||
<Directory ${patchman_pythonpath}> | ||
<Files wsgi.py> | ||
Require all granted | ||
</Files> | ||
AllowOverride All | ||
</Directory> | ||
|
||
Alias /patchman/static "/var/lib/patchman/static" | ||
<Location /patchman/static> | ||
SetHandler None | ||
</Location> | ||
|
||
<Directory /var/lib/patchman/static> | ||
Require all granted | ||
</Directory> | ||
|
||
<Location /patchman/reports/upload> | ||
# Add the IP addresses of your client networks/hosts here | ||
# to allow uploading of reports | ||
Require ip 0.0.0.0/0.0.0.0 | ||
</Location> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
# Function to cleanly shut down processes | ||
cleanup() { | ||
echo "Caught Signal... terminating Apache ($APACHE_PID) and patchman ($PATCHMAN_PID) gracefully!" | ||
# Kill the Apache process | ||
kill -TERM $APACHE_PID | ||
# Kill the patchman process | ||
kill -TERM $PATCHMAN_PID | ||
exit 0 | ||
} | ||
|
||
# Trap SIGTERM, SIGINT and exit signals | ||
trap cleanup SIGTERM SIGINT EXIT | ||
|
||
echo "running migrations..." | ||
patchman-manage migrate | ||
|
||
echo "Starting Apache2..." | ||
# Starts apache2ctl in the foreground | ||
apache2ctl -D FOREGROUND & | ||
|
||
# Apache process ID | ||
APACHE_PID=$! | ||
|
||
# Function to run patchman in the background periodically | ||
run_patchman() { | ||
while true; do | ||
# Run patchman command | ||
patchman -a | ||
# Wait for 10min (600 seconds) before running again | ||
sleep 600 | ||
done | ||
} | ||
|
||
echo "starting patchman processing loop..." | ||
# Start the patchman function in the background | ||
run_patchman & | ||
|
||
# Capture the process ID of the background job | ||
PATCHMAN_PID=$! | ||
|
||
# Wait for Apache to exit | ||
wait $APACHE_PID | ||
|
||
# Once Apache exits, kill the background patchman job if still running | ||
kill $PATCHMAN_PID | ||
|