netwatch script write to hotspot file

RouterOS 6.34.3 on a RB951G-2HnD

I have:

/tool netwatch add \
    comment=link \
    host=192.168.11.31 \
    interval=10s \
    up-script=":execute script=\":put true\" file=\"/hotspot/ping/192.168.11.31.json\"" \
    down-script=":execute script=\":put false\" file=\"/hotspot/ping/192.168.11.31.json\""

the idea being that I can use AJAX in the hotspot status page to grab the contents of this file and display the status of the host 192.168.31.1 (which is the next link of several on the way to the Internet).

If I run the up/down scripts on the command line, the file contents is updated, but in netwatch I can see the status change from “up” to “down” or vice-versa, but the contents of the file never changes.

What am I doing wrong?

Thanks,
Rob.

Answering my own question:

I suspect it might be something to do with the user that runs the netwatch script not having permission to write to a file, or something like that.

I put the script actions into separate scripts (in /system scripts), and then just trigger those from /tool netwatch, and it works.

Rob.