Skip to content

Run on asuswrt merlin

Sameer Dhoot edited this page Nov 4, 2020 · 2 revisions

Run on ASUS Router with asuswrt-merlin firmware

I initially thought of running this application on my router, so I needed to build the application without having to install build tool on my router. I use the following PowerShell one liner to build targeting the ARM v5 platform on my Windows machine with VS Code:

 $Env:GOOS = "linux"; $Env:GOARCH = "arm"; $Env:GOARM = "5"; go build -o wolweb .

All the files you need to copy

  • static
    • wolweb.js
    • wolweb.css
    • index.html
  • config.json
  • devices.json
  • index.html
  • wolweb

Make sure that you make the wolweb file executable.

chmod +x wolweb

To start this program at boot

You have to make a script in init.d directory. Full script path is /opt/etc/init.d/S90wolweb

#!/bin/sh

PATH=/tmp/mnt/entware/WolWeb:/opt/sbin:/opt/bin:/opt/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

case $1 in
    start)
    logger -t wolweb "wolweb starting..."
    wolweb > /tmp/mnt/entware/WolWeb/wolweb.log 2>&1 &
    logger -t wolweb "wolweb started..."
    ;;
    stop)
    logger -t wolweb "wolweb stopping..."
    pkill wolweb && echo 'wolweb force stopped.'
    logger -t wolweb "wolweb stopped..."
    ;;
    restart)
    logger -t wolweb "wolweb stopping..."
    pkill wolweb && echo 'wolweb force stopped.'
    logger -t wolweb "wolweb stopped..."
    logger -t wolweb "wolweb starting..."
    wolweb > /tmp/mnt/entware/WolWeb/wolweb.log 2>&1 &
    logger -t wolweb "wolweb started..."
    ;;
esac

Make this script as executable

chmod +x /opt/etc/init.d/S90wolweb

That is all what is required to start this application at boot.

Clone this wiki locally