#!/bin/sh set -eu script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) pid_file="$script_dir/.runtime/launcher.pid" if [ ! -r "$pid_file" ]; then rm -f "$script_dir/.runtime/launcher.log" exit 0 fi read -r pid < "$pid_file" case "$pid" in '' | *[!0-9]*) exit 1 ;; esac command=$(ps -p "$pid" -o command= 2>/dev/null || true) case "$command" in *"$script_dir/start-opnsense.sh"*) kill "$pid" rm -f "$script_dir/.runtime/launcher.log" ;; *) exit 1 ;; esac