29 lines
645 B
Bash
Executable File
29 lines
645 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Ensure the configuration directory exists
|
|
if [ ! -f /etc/webhookd.conf ]; then
|
|
cat <<EOL > /etc/webhookd.conf
|
|
# Webhook Daemon Configuration
|
|
SCRIPT_FOLDER=/webhooks/
|
|
HOST=0.0.0.0
|
|
PORT=8443
|
|
CERT_FILE=/etc/ssl/certs/webhookd.crt
|
|
KEY_FILE=/etc/ssl/private/webhookd.key
|
|
EOL
|
|
fi
|
|
|
|
# Create the system user if not exists
|
|
if ! id -u webhookd >/dev/null 2>&1; then
|
|
useradd -r -s /bin/false webhookd
|
|
fi
|
|
|
|
# Set ownership for the script folder
|
|
mkdir -p /webhooks/
|
|
chown -R webhookd:webhookd /webhooks/
|
|
|
|
# Reload systemd and enable the service
|
|
systemctl daemon-reload
|
|
systemctl enable webhookd.service
|
|
systemctl start webhookd.service
|
|
|