The main script can now be used as a daemon.