#!/bin/sh /etc/rc.common START=99 STOP=10 USE_PROCD=1 CONTAINER_NAME="sabnzbd" start_service() { local enabled config_load sabnzbd config_get enabled main enabled '0' [ "$enabled" = "1" ] || return 0 # Start LXC container if lxc-info -n "$CONTAINER_NAME" >/dev/null 2>&1; then lxc-start -n "$CONTAINER_NAME" -d 2>/dev/null logger -t sabnzbd "SABnzbd container started" else logger -t sabnzbd "Container not installed. Run: sabnzbdctl install" fi } stop_service() { if lxc-info -n "$CONTAINER_NAME" 2>/dev/null | grep -q "RUNNING"; then lxc-stop -n "$CONTAINER_NAME" -t 30 logger -t sabnzbd "SABnzbd container stopped" fi } reload_service() { stop_service start_service } service_triggers() { procd_add_reload_trigger "sabnzbd" }