changemaker.lite/termux-sms/sms-service.sh
bunker-admin 9321aeb263 Move SMS phone bridge from campaign_connector submodule into main repo
Consolidates the Termux SMS server code (previously in a separate
campaign_connector git submodule) into termux-sms/ at repo root.
Updates phone clone commands to use sparse checkout so only the
termux-sms/ directory is downloaded onto the Android device.

Bunker Admin
2026-03-31 11:04:14 -06:00

44 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# SMS API Service management script
case "$1" in
start)
echo "Starting SMS API Server..."
nohup ~/bin/start-sms-api.sh > ~/logs/sms-api-service.log 2>&1 &
echo $! > ~/.sms-api.pid
echo "Service started (PID: $(cat ~/.sms-api.pid))"
;;
stop)
if [ -f ~/.sms-api.pid ]; then
PID=$(cat ~/.sms-api.pid)
kill $PID 2>/dev/null || true
rm -f ~/.sms-api.pid
echo "Service stopped"
else
echo "Service not running"
fi
;;
status)
if [ -f ~/.sms-api.pid ]; then
PID=$(cat ~/.sms-api.pid)
if kill -0 $PID 2>/dev/null; then
echo "Service running (PID: $PID)"
else
echo "Service dead (stale PID file)"
rm -f ~/.sms-api.pid
fi
else
echo "Service not running"
fi
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac