add daemonization function to startup.c
add rudimentary log support