add daemonization function to startup.c
add rudimentary log support
fix log creation permissions