nilp0inter / MiSTer_WebMenu

A web interface for MiSTer
Apache License 2.0
61 stars 9 forks source link

Autostart Webmenu on each MiSTer start #10

Open yavimaya opened 4 years ago

yavimaya commented 4 years ago

The initial script should offer the possibility to autostart each time you turn on MiSTer.

Maybe you can use /etc/init.d/ dir.

nilp0inter commented 4 years ago

This one should be easy, not a priority right now, though. I'll plan to add it after game support.

Gdsimms commented 4 years ago

Here's what I did:

create the file /etc/init.d/S99webmenu with the following contents:

#!/bin/sh

[ -f /media/fat/Scripts/webmenu.sh ] || exit 0

start() {
        printf "Starting WebMenu service: "
        /media/fat/Scripts/webmenu.sh
        [ $? = 0 ] && echo "OK" || echo "FAIL"
}

stop() {
        printf "Shutting down WebMenu service: "
        kill -9 `pidof WebMenu`
        [ $? = 0 ] && echo "OK" || echo "FAIL"
}

restart() {
        stop
        start
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $?