Something simpler

If you just want to run a task in the background after the user logs out, you can just run nohup <command> &, the standard output and standard error streams are redirected to a file named nohup.out in the current directory by default. But this doesn’t restart the service on failure or after a reboot etc.