add daemonization function to startup.c
add rudimentary log support
fix log creation permissions
add stderr log
pre-init stdout