Trying to write up a C daemon, but don't know enough C to continue
Posted
by
JamesM-SiteGen
on Stack Overflow
See other posts from Stack Overflow
or by JamesM-SiteGen
Published on 2011-05-20T09:15:03Z
Indexed on
2012/07/02
21:16 UTC
Read the original article
Hit count: 268
Okay, so I want this daemon to run in the background with little to no interaction. I plan to have it work with Apache, lighttpd, etc to send the session & request information to allow C to generate a website from an object DB, saving will have to be an option so, you can start the daemon with an existing DB but will not save to it unless you login to the admin area and enable, and restart the daemon.
Summary of the daemon:
- Load a database from file.
- Have a function to restart the daemon.
- Allow Apache, lighttpd, etc to get necessary data about the request and session.
- A varible to allow the database to be saved to the file, otherwise it will only be stored in ram.
- If it is set to save back to the file, then only have neccessary data in ram.
- Use sql-light for the database file.
- Build a webpage from some template files.
- $(myVar) for getting variables.
- Get templates from a directory. ./templates/01-test/{index.html,template.css,template.js}
Live version of the code and more information: http://typewith.me/YbGB1h1g1p Also I am working on a website CMS in php, but I am tring to switch to C as it is faster than php. ( php is quite fast, but the fact that making a few mySQL requests for every webpage is quite unefficent and I'm sure that it can be far better, so an object that we can recall data from in C would have to be faster )
P.S I am using Arch-Linux not MS-Windows, with the package group base-devel for the common developer tools such as make and makepgk.
Edit: Oupps, forgot the question ;)
Okay, so the question is, how can I turn this basic C daemon into a base to what I am attempting to do here?
© Stack Overflow or respective owner