#!/bin/bash
set -e

echo "Installing Momentry Worker as a system service..."

# Copy worker plist to system LaunchDaemons
sudo cp /Users/accusys/momentry_core_0.1/momentry_runtime/plist/com.momentry.worker.plist /Library/LaunchDaemons/

# Load the service
sudo launchctl load /Library/LaunchDaemons/com.momentry.worker.plist

echo "Worker service installed successfully."
echo "Checking service status..."
launchctl list | grep com.momentry.worker || echo "Service not listed in user domain; check system domain."
