#!/bin/sh
mpc_flag="/var/startmpc.flag"
exec_flag="/var/exec.flag"
while [ true ]; do
  if [ -f "$mpc_flag" ]; then
    echo Restart!
    rm "$mpc_flag"
    /etc/init.d/S81clover-mcp start
  fi
  if [ -f "$exec_flag" ]; then
    cmd="$(cat "$exec_flag")"
    rm "$exec_flag"
    $cmd
  fi
  usleep 200000
done
