Add run script and improve error handling
- Add run.sh script to automate IP list update and nginx reload - Improve core.clj error handling with try/catch block - Remove redundant string import in core.clj - Add logging with timestamps to run script - Exit with proper status codes in both success and failure cases
This commit is contained in:
20
run.sh
Executable file
20
run.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
# Function to log messages with a timestamp
|
||||
log_message() {
|
||||
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1"
|
||||
}
|
||||
|
||||
log_message("Update Bunny IPs list...")
|
||||
bb -m bunny2realip.core
|
||||
|
||||
if [ $? -eq 0]; then
|
||||
log_message("Reload nginx configuration...")
|
||||
systemctl reload nginx
|
||||
if [ $? -eq 0]; then
|
||||
log_message("Update successfully!")
|
||||
else
|
||||
log_message("nginx: Something went wrong!")
|
||||
fi
|
||||
else
|
||||
log_message("bunny2realip: Something went wrong!")
|
||||
fi
|
||||
Reference in New Issue
Block a user