I’m playing around with socket activation, creating something like:
mysock:
command: mysock.sh
plugs: [ network-bind ]
daemon: oneshot
restart-condition: never
sockets:
mysock:
listen-stream: $SNAP_DATA/socket
socket-mode: 0644
and a shell script (mysock.sh) like:
#! /bin/sh
set -e
echo "socket triggered"
creates a socket just fine and i can do something like:
echo foo|sudo nc -q 1 -U /var/snap/<snapname>/current/socket
this actually triggers the script and properly makes it print “socket triggered” in syslog …
… but … it does not seem to respect the oneshot or restart-condition directives above and simply goes into a restart loop.
is that me misunderstanding how our socket implementation works or is there a bug with snapd not respecting oneshot when sockets are used (then we should perhaps add a syntax check in snapcraft)