);
+# this POE session will start maintenance operations
+# ticked every 5 minutes
+POE::Session->create(
+ inline_states => {
+ _start => sub {
+ # start the next tick
+ $_[HEAP]->{next_alarm_time} = int(time()) + 60 * 5;
+ $_[KERNEL]->alarm(tick => $_[HEAP]->{next_alarm_time});
+ },
+
+ # a tick every 5 minutes
+ tick => sub {
+ # make sure the next tick is initialized
+ $_[HEAP]->{next_alarm_time} = $_[HEAP]->{next_alarm_time} + 60 * 5;
+ $_[KERNEL]->alarm(tick => $_[HEAP]->{next_alarm_time});
+
+ # call the real maintenance function
+ maintenance();
+ },
+ },
+);
+
+
# watchdog()
#
-# verify connections
+# verify network connections
#
# parameter:
# none
}
+# maintenance()
+#
+# verify database connection, do some maintenance
+#
+# parameter:
+# none
+# return:
+# none
+sub maintenance {
+ if (!test_database()) {
+ print_msg("Database not connected!", ERROR);
+ }
+
+ # FIXME: update website cache
+}
+
+
# send_to_commandchannel()
#
# send a message to the command channel