I have created a daemon that copies data from source to destination directory.
I have named it cpd
(copy daemon). It periodically runs this cp
command: cp src dest
But if I need to change the interval of this cp
command execution, how should I communicate with the cpd
daemon?
For example: cpd -p 120
--> where -p
indicates period and 120
is in seconds.
PS: "I know how to start a background process: create a child and exit from parent process,
set new session id, close inherited standard file descriptors, change working directory. The standard steps to create a daemon. I am also using syslog
to log status messages after each command are executed."
@Paul:
So i need a config file like this one below. and when I run without -d
option I should signal the daemon to read this file and change its variables, behaviour accordingly. Is that right?
# Example configuration file for cpd - An test Linux daemon.
# Comments start with a # and are ignored.
# Configuration options are delimited by = and ;
# Example:
# arg=val;
verbose_logging_enabled=true;
daemon_enabled=false;
config_file_path=/etc/cpd.conf;
source_path=/home/Documents/Source;
destination_path=/home/Documents/Destination;