To have any program run when the computer boots, you will need to call it from an autorun script.
First, what I would suggest is to place your program in the "/usr/bin" directory, that way it can be called by name without specifying the directory path. This is optional but I find it useful. Next, create a new file in the root "/" directory, called "autorun.lua". In this script, use the following code, supposing your program name was "pass.lua". Then reboot it too test.
os.execute("pass.lua")
As far as preventing program termination, I have found one post that describes a method involving c