autorestart

This commit is contained in:
bedweb 2025-09-30 09:27:24 +02:00
parent e67eee4a81
commit 96326f6c44
4 changed files with 21 additions and 12 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
*/1 * * * * /root/ais/ais-autorestart.sh

8
ais-autorestart.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
SERVICE="ais-runner"
if ! rc-service $SERVICE status | grep -q "started"; then
echo "$(date): $SERVICE is down. Restarting..." >> /var/log/service-monitor.log
rc-service $SERVICE restart
fi

0
ais-runner Normal file → Executable file
View File

View File

@ -124,20 +124,20 @@ if [ "$API_KEY" = "YOUR_API_KEY_HERE" ] || [ -z "$API_KEY" ]; then
fi fi
# Validate JSON formats # Validate JSON formats
if ! validate_json "$BOUNDING_BOX"; then #if ! validate_json "$BOUNDING_BOX"; then
echo "Error: Invalid bounding box JSON format" >&2 # echo "Error: Invalid bounding box JSON format" >&2
exit 1 # exit 1
fi #fi
if ! validate_json "$SHIP_MMSI_FILTER"; then #if ! validate_json "$SHIP_MMSI_FILTER"; then
echo "Error: Invalid MMSI filter JSON format" >&2 # echo "Error: Invalid MMSI filter JSON format" >&2
exit 1 # exit 1
fi #fi
if ! validate_json "$MESSAGE_TYPE_FILTER"; then #if ! validate_json "$MESSAGE_TYPE_FILTER"; then
echo "Error: Invalid message type filter JSON format" >&2 # echo "Error: Invalid message type filter JSON format" >&2
exit 1 # exit 1
fi #fi
# Create subscription message # Create subscription message
create_subscription_message() { create_subscription_message() {