0
votes

I'm trying to create a VM which listen to a TCP port via nc. I want to start listening at every boot, thus I wrote the following cloud-config file:

#cloud-config

# Allows to run runcmd at every boot
cloud_final_modules:
- [scripts-user, always]

runcmd:
  # Listen to port 80
  - [ nohup, nc, -k, -l, 80, & ]

The process is allegedly killed when cloud-init finishes, despite being detached.

Any ideas? am I really forced to use to systemd instead?

Thank you