New proto script question -- how to daemonize the binary?

I'm trying to create a protocol netifd script for netclient/netmaker. The binary which should be daemonized just creates a wg link, but I don't know how to daemonize (and then kill on proto_teardown) a binary from netifd script. Any suggestions?

Anyone? @jow?

The appropriate functions to use are proto_add_command() and proto_kill_command() - see

and

for real life examples. The first argument of both functions is the logical interface name, all subsequent arguments for proto_add_command() form the argument vector.

This requires that the invoked command stays in foreground and does not daemonize itself. When the called process terminates by itself (e.g. due to a crash), netifd will tear down the related interface. When an "ifdown ..." is issued for the related interface, netifd will terminate the related process.

2 Likes