#!/bin/bash # Perizinan Data Sync Script for Linux Server # Runs daily at midnight to sync data from API # Set project directory (adjust this path for your production server) PROJECT_DIR="/var/www/perling" # Change to project directory cd "$PROJECT_DIR" # Log start time echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting perizinan data sync" >> storage/logs/cron.log # Run the sync command php artisan perizinan:sync --all >> storage/logs/cron.log 2>&1 # Log completion echo "[$(date '+%Y-%m-%d %H:%M:%S')] Perizinan data sync completed" >> storage/logs/cron.log echo "" >> storage/logs/cron.log # Optional: Send notification if sync fails # if [ $? -ne 0 ]; then # echo "[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: Perizinan sync failed" >> storage/logs/cron.log # fi