require Guardian::Base;
require Guardian::Config;
+require Guardian::Daemon;
require Guardian::Logger;
require Guardian::Parser;
require Guardian::Socket;
# (Does not include the socket thread)
my @running_workers;
+# Check if guardian should be daemonized or keep in the foreground.
+unless (defined($cmdargs{"foreground"})) {
+ # Fork into background.
+ &Guardian::Daemon::Daemonize();
+} else {
+ # Write PID (process-id).
+ &Guardian::Daemon::WritePID();
+}
+
# Call Init function to initzialize guardian.
&Init();