Advertisement
KirboWnz

S70cx_ai_middleware

Sep 7th, 2023
1,260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.94 KB | None | 0 0
  1. root@creality / [#] cat /etc/init.d/S70cx_ai_middleware
  2. #!/bin/sh
  3. #
  4. # Starts cx_ai_middleware service.
  5. #
  6.  
  7. PROG=/usr/bin/cx_ai_middleware
  8. PID_FILE=/var/run/cx_ai_middleware.pid
  9. FLAG_FILE=/tmp/.laser_updating
  10.  
  11. start() {
  12.  
  13.     while true
  14.     do
  15.         if [ -e $FLAG_FILE ]; then
  16.             sleep 0.2
  17.         else
  18.             break
  19.         fi
  20.     done
  21.  
  22.     printf "Starting cx_ai_middleware service: "
  23.  
  24.     start-stop-daemon -S -b -m -p $PID_FILE \
  25.         --exec $PROG
  26.     [ $? = 0 ] && echo "OK" || echo "FAIL"
  27. }
  28. stop() {
  29.     printf "Stopping cx_ai_middleware service: "
  30.  
  31.     start-stop-daemon -K -p $PID_FILE
  32.     [ $? = 0 ] && echo "OK" || echo "FAIL"
  33. }
  34. restart() {
  35.     stop
  36.     sleep 1
  37.     start
  38. }
  39.  
  40. case "$1" in
  41.     start)
  42.         start
  43.         ;;
  44.     stop)
  45.         stop
  46.         ;;
  47.     restart|reload)
  48.         restart
  49.         ;;
  50.     *)
  51.         echo "Usage: $0 {start|stop|restart}"
  52.         exit 1
  53. esac
  54.  
  55. exit $?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement