#!/bin/bash

set -e

# Define the log file path
LOG_FILE="/var/log/metadata.log"

# Check if the log file exists; create it if it doesn't
if [ ! -e "$LOG_FILE" ]; then
  touch "$LOG_FILE"
  chmod 644 "$LOG_FILE"  # Set appropriate permissions for the log file
  echo "Created log file: $LOG_FILE"
else
  echo "Log file already exists: $LOG_FILE"
fi


# Enable the service and timer
systemctl enable simplevm-metadata-synchronizer.service
systemctl enable simplevm-metadata-synchronizer.timer

# Start the service and timer
systemctl start simplevm-metadata-synchronizer.timer

exit 0
