Files
mqtt_srv/mqtt_srv.sh
2025-08-27 04:27:38 +02:00

28 lines
664 B
Bash

#!/bin/bash
THIS_HOST=`uname -n`
case $1 in
"start")
echo "`date` : Starting service" >> /tmp/mqtt_srv.log
if [ "$THIS_HOST" == "nas" ]
then
echo "$?" >> /tmp/mqtt_srv.log
/share/Data/python/bin/python3 /usr/bin/mqtt_srv.py > /dev/null 2>&1 &
echo "$?" >> /tmp/mqtt_srv.log
else
python3 /jffs/scripts/mqtt_srv/mqtt_srv.py > /dev/null 2>&1 &
fi
cp /share/Data/nas_bash_history /root/.bash_history
;;
"stop")
echo lala1 >> /tmp/mqtt_srv.log
kill -9 `ps |grep -e "mqtt_srv.py"|grep -v grep|awk '{ print $1}'`
cp /root/.bash_history /share/Data/nas_bash_history
;;
"restart")
$0 stop
$0 start
;;
"status")
ps |grep -e "mqtt_srv.py"|grep -v grep
;;
esac