4 ms·
writing a daemon is not necessarily a repetitive process, all the stuff that you "have to do" are driven by engineering demands. You have to think of them consc
by mahmud 18y ago
writing a daemon is not necessarily a repetitive process, all the stuff that you "have to do" are driven by engineering demands. You have to think of them consciously before you do each one and there is no particular number of them and no particular order, it's all dictated by your application: when to fork and let the parent die? when to give up terminal? change directory? reset/change umask? what file descriptors to close which ones to open and what to keep? logging? other IPC channels for client apps? etc.
this stuff is not cruft or boiler-plate is it? also, you shouldn't be writing daemons so often as to need a framework, and if you do, you better understand all that goes into it.
- DannoHung 18y agoI'd like to learn more about daemons to satisfy my own personal curiosity. Do you have any resources you recommend?
- alxv 18y agoRichard Stevens's "Advanced Programming in the UNIX Environment" has a chapter dedicated to how to write well-behaved daemons. The book is a great investment if you are doing any kind of UNIX programming; I highly recommend it.
- stratomorph 18y agoI agree that it's not boiler-plate, and I don't mean that I do it all that often, maybe every six months or so when I find something new I want my home server to do. (Like the last one, experimenting with port knocking) I am by no means a professional programmer, that's why I find myself making the same searches.
- mahmud 18y agoCheers! didn't mean to come off so nanny-like ;-)