added time to log

This commit is contained in:
oliver
2026-04-21 17:42:17 -03:00
parent 3deb54f5aa
commit 7e23c50a4f
3 changed files with 10 additions and 11 deletions
+4 -4
View File
@@ -8,20 +8,20 @@ do
for dir in ???-???-*; do for dir in ???-???-*; do
if [ -d "${dir}/cc" ]; then if [ -d "${dir}/cc" ]; then
if [ -f "${dir}/cc/backup" ]; then if [ -f "${dir}/cc/backup" ]; then
echo "BACKUP for: ${dir%/}" echo "$(date '+%Y-%m-%d %H:%M:%S') BACKUP for: ${dir%/}"
/4server/sbin/backupContainer ${dir%/} 2 /4server/sbin/backupContainer ${dir%/} 2
rm "${dir}/cc/backup" rm "${dir}/cc/backup"
fi fi
if [ -f "${dir}/cc/restart" ]; then if [ -f "${dir}/cc/restart" ]; then
echo "Restart for: ${dir%/}" echo "$(date '+%Y-%m-%d %H:%M:%S') Restart for: ${dir%/}"
/4server/sbin/startContainer ${dir%/} /4server/sbin/startContainer ${dir%/}
rm "${dir}/cc/restart" rm "${dir}/cc/restart"
fi fi
if [ -f "${dir}/cc/restore" ]; then if [ -f "${dir}/cc/restore" ]; then
FILENAME=$(head -n 1 "${dir}/cc/restore") FILENAME=$(head -n 1 "${dir}/cc/restore")
echo "Restore for: ${dir%/} - $FILENAME" echo "$(date '+%Y-%m-%d %H:%M:%S') Restore for: ${dir%/} - $FILENAME"
/4server/sbin/ODOO_19/restore ${dir%/} $FILENAME /4server/sbin/ODOO_19/restore ${dir%/} $FILENAME
rm "${dir}/cc/restore" rm "${dir}/cc/restore"
fi fi
@@ -29,7 +29,7 @@ for dir in ???-???-*; do
if [ -d "${dir}/n8n" ]; then if [ -d "${dir}/n8n" ]; then
if [ -f "${dir}/n8n/database.sqlite-journal" ]; then if [ -f "${dir}/n8n/database.sqlite-journal" ]; then
echo "Restart N8N (journal)for: ${dir%/}" echo "$(date '+%Y-%m-%d %H:%M:%S') Restart N8N (journal) for: ${dir%/}"
/4server/sbin/startContainer ${dir%/} /4server/sbin/startContainer ${dir%/}
fi fi
fi fi
+2 -3
View File
@@ -2,7 +2,7 @@
# Check that a search string was provided # Check that a search string was provided
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "Usage: $0 <search_string>" echo "$(date '+%Y-%m-%d %H:%M:%S') Usage: $0 <search_string>"
exit 1 exit 1
fi fi
@@ -16,8 +16,7 @@ uuids=$(sqlite3 "$DB_PATH" "SELECT UUID FROM containers WHERE tags LIKE '%$SEARC
for uuid in $uuids; do for uuid in $uuids; do
# Check if a container with this name is running # Check if a container with this name is running
if doas docker ps --format '{{.Names}}' | grep -qx "$uuid"; then if doas docker ps --format '{{.Names}}' | grep -qx "$uuid"; then
echo "Restarting $uuid" echo "$(date '+%Y-%m-%d %H:%M:%S') Restarting $uuid"
/4server/sbin/startContainer $uuid /4server/sbin/startContainer $uuid
fi fi
done done
+4 -4
View File
@@ -2,7 +2,7 @@
# Usage: ./start_by_uuid.sh <uuid> # Usage: ./start_by_uuid.sh <uuid>
# Example: ./start_by_uuid.sh abc-001-xxxx-xxxx-xxxx # Example: ./start_by_uuid.sh abc-001-xxxx-xxxx-xxxx
exec > /4server/data/log/startContainer.log 2>&1 exec > /4server/data/log/startContainer.log 2>&1
echo "$(date '+%Y-%m-%d %H:%M') Start container $1" echo "$(date '+%Y-%m-%d %H:%M:%S') Start container $1"
source /4server/sbin/helpers source /4server/sbin/helpers
@@ -11,12 +11,12 @@ BIN_PATH="/4server/sbin"
UUID="$1" UUID="$1"
if [[ -z "$UUID" ]]; then if [[ -z "$UUID" ]]; then
echo "Usage: $0 <uuid>" echo "$(date '+%Y-%m-%d %H:%M:%S') Usage: $0 <uuid>"
exit 1 exit 1
fi fi
if [[ ! "$UUID" =~ ^[0-9a-fA-F-]+$ ]]; then if [[ ! "$UUID" =~ ^[0-9a-fA-F-]+$ ]]; then
echo "ERROR: Invalid UUID format: $UUID" echo "$(date '+%Y-%m-%d %H:%M:%S') ERROR: Invalid UUID format: $UUID"
exit 1 exit 1
fi fi
@@ -59,7 +59,7 @@ case "$SECOND_PART" in
*) *)
echo "Unknown UUID type: $SECOND_PART" echo "$(date '+%Y-%m-%d %H:%M:%S') Unknown UUID type: $SECOND_PART"
exit 2 exit 2
;; ;;
esac esac