You should use Cron:
Cron is a system daemon used to execute desired tasks (in the background) at designated times.
Basically, you define a script to be executed every hour with this syntax:
0 */1 * * * /path/to/script.sh
Check here for more info: https://help.ubuntu.com/community/CronHowto
For OpenWrt specific setup, check here: http://martybugs.net/wireless/openwrt/cron.cgi
For your specific case, you can use the following design:
- Cron jobs triggers every full hour
- The custom script gets executed and uses an IPC mechanism to inform the main app.
- The main app has a dedicated function in the writter handler that does what is necessary to reset the writter (other function calls, file deletion, creating new file, etc.)
For an overview of IPC methods to get you started, check this Wikipedia article.
For specific implementations you can use Boost.Interprocess, Sockets, Pipes, and others.