summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2010-02-11 09:41:23 +0000
committerChristian Pointner <equinox@helsinki.at>2010-02-11 09:41:23 +0000
commite6d92c3f894d749168af7a6c0a873f7c5125e8a7 (patch)
tree9958a1a00d89a54552482a803df2fdb242319e12
parentfixed/updated manpage (diff)
added -d|--dirs parameter to options parser
cleaned up manpage
-rw-r--r--doc/rhdropbox.839
-rw-r--r--doc/rhdropbox.8.txt35
-rw-r--r--options.c5
-rw-r--r--options.h1
4 files changed, 50 insertions, 30 deletions
diff --git a/doc/rhdropbox.8 b/doc/rhdropbox.8
index c9f0ae5..192059d 100644
--- a/doc/rhdropbox.8
+++ b/doc/rhdropbox.8
@@ -33,6 +33,8 @@ rhdropbox \- radio helsinki dropbox daemon
[ \fB\-L|\-\-log\fR <target>:<level>[,<param1>[,<param2>[\&.\&.]]] ]
[ \fB\-s|\-\-command\-sock\fR <unix sock> ]
[ \fB\-x|\-\-script\fR <script> ]
+ [ \fB\-m|\-\-max\-children\fR <#of children> ]
+ [ \fB\-d|\-\-dir\fR <path> ]
.fi
.SH "DESCRIPTION"
.sp
@@ -48,31 +50,31 @@ This option instructs
to run in foreground instead of becoming a daemon which is the default\&.
.RE
.PP
-\fB\-u, \-\-username <username>\fR
+\fB\-u, \-\-username \fR\fB\fI<username>\fR\fR
.RS 4
run as this user\&. If no group is specified (\fB\-g\fR) the default group of the user is used\&. The default is to not drop privileges\&.
.RE
.PP
-\fB\-g, \-\-groupname <groupname>\fR
+\fB\-g, \-\-groupname \fR\fB\fI<groupname>\fR\fR
.RS 4
run as this group\&. If no username is specified (\fB\-u\fR) this gets ignored\&. The default is to not drop privileges\&.
.RE
.PP
-\fB\-C, \-\-chroot <path>\fR
+\fB\-C, \-\-chroot \fR\fB\fI<path>\fR\fR
.RS 4
Instruct
\fBrhdropbox\fR
to run in a chroot jail\&. The default is to not run in chroot\&.
.RE
.PP
-\fB\-P, \-\-write\-pid <filename>\fR
+\fB\-P, \-\-write\-pid \fR\fB\fI<filename>\fR\fR
.RS 4
Instruct
\fBrhdropbox\fR
to write it\(cqs pid to this file\&. The default is to not create a pid file\&.
.RE
.PP
-\fB\-L, \-\-log <target>:<level>[,<param1>[,<param2>[\&.\&.]]]\fR
+\fB\-L, \-\-log \fR\fB\fI<target>:<level>[,<param1>[,<param2>[\&.\&.]]]\fR\fR
.RS 4
add log target to logging system\&. This can be invoked several times in order to log to different targets at the same time\&. Every target hast its own log level which is a number between 0 and 5\&. Where 0 means disabling log and 5 means debug messages are enabled\&.
@@ -82,59 +84,66 @@ is added\&.
The following targets are supported:
.PP
-\fBsyslog\fR
+\fIsyslog\fR
.RS 4
log to syslog daemon, parameters <level>[,<logname>[,<facility>]]
.RE
.PP
-\fBfile\fR
+\fIfile\fR
.RS 4
log to file, parameters <level>[,<path>]
.RE
.PP
-\fBstdout\fR
+\fIstdout\fR
.RS 4
log to standard output, parameters <level>
.RE
.PP
-\fBstderr\fR
+\fIstderr\fR
.RS 4
log to standard error, parameters <level>
.RE
.RE
.PP
-\fB\-s|\-\-command\-sock <unix sock>\fR
+\fB\-s|\-\-command\-sock \fR\fB\fI<unix sock>\fR\fR
.RS 4
\fBrhdropbox\fR
will listen on this unix socket for incoming commands\&. See next chapter for details\&. The default is /var/run/rhdropbox/cmd\&.sock
.RE
.PP
-\fB\-x|\-\-script <script>\fR
+\fB\-x|\-\-script \fR\fB\fI<script>\fR\fR
.RS 4
The script which should be called when a new file is found\&. The following parameter are passed to the scipt:
.PP
-\fB<path>\fR
+\fI<path>\fR
.RS 4
the path to the folder containing the new file
.RE
.PP
-\fB<filename>\fR
+\fI<filename>\fR
.RS 4
the name of the new file relative to <path>
.RE
.PP
-\fB<filesize>\fR
+\fI<filesize>\fR
.RS 4
the size of the file right after the event was received, this can be used to determine wheter the file is complete\&. The script should consider a file to be complete when it size doesn\(cqt change 3\-5seconds after the event got received\&.
.RE
.RE
.PP
-\fB\-m|\-\-max\-children <#of children>\fR
+\fB\-m|\-\-max\-children \fR\fB\fI<#of children>\fR\fR
.RS 4
Limits the total concurrent executions of
\fB\-x|\-\-script\fR\&. A value of 0 means no limit\&.
.RE
+.PP
+\fB\-d|\-\-dir \fR\fB\fI<path>\fR\fR
+.RS 4
+Add
+\fI<path>\fR
+to the watch list\&. This can be invoked serveral times\&.
+.RE
.SH "COMMAND INTERFACE"
.sp
\fBrhdropbox\fR is listening for incoming commands at the unix socket speciefied by the \fB\-s|\-\-command\-sock\fR parameter\&. You can connect to this socket for example using socat:
diff --git a/doc/rhdropbox.8.txt b/doc/rhdropbox.8.txt
index c245a2a..6ec25fb 100644
--- a/doc/rhdropbox.8.txt
+++ b/doc/rhdropbox.8.txt
@@ -21,6 +21,8 @@ rhdropbox
[ -L|--log <target>:<level>[,<param1>[,<param2>[..]]] ]
[ -s|--command-sock <unix sock> ]
[ -x|--script <script> ]
+ [ -m|--max-children <#of children> ]
+ [ -d|--dir <path> ]
....
@@ -42,23 +44,23 @@ The following options can be passed to the *rhdropbox* daemon:
This option instructs *rhdropbox* to run in foreground
instead of becoming a daemon which is the default.
-*-u, --username <username>*::
+*-u, --username '<username>'*::
run as this user. If no group is specified (*-g*) the default group of
the user is used. The default is to not drop privileges.
-*-g, --groupname <groupname>*::
+*-g, --groupname '<groupname>'*::
run as this group. If no username is specified (*-u*) this gets ignored.
The default is to not drop privileges.
-*-C, --chroot <path>*::
+*-C, --chroot '<path>'*::
Instruct *rhdropbox* to run in a chroot jail. The default is
to not run in chroot.
-*-P, --write-pid <filename>*::
+*-P, --write-pid '<filename>'*::
Instruct *rhdropbox* to write it's pid to this file. The default is
to not create a pid file.
-*-L, --log <target>:<level>[,<param1>[,<param2>[..]]]*::
+*-L, --log '<target>:<level>[,<param1>[,<param2>[..]]]'*::
add log target to logging system. This can be invoked several times
in order to log to different targets at the same time. Every target
hast its own log level which is a number between 0 and 5. Where 0 means
@@ -68,29 +70,32 @@ The following options can be passed to the *rhdropbox* daemon:
config *syslog:3,rhdropbox,daemon* is added. +
The following targets are supported:
- *syslog*;; log to syslog daemon, parameters <level>[,<logname>[,<facility>]]
- *file*;; log to file, parameters <level>[,<path>]
- *stdout*;; log to standard output, parameters <level>
- *stderr*;; log to standard error, parameters <level>
+ 'syslog';; log to syslog daemon, parameters <level>[,<logname>[,<facility>]]
+ 'file';; log to file, parameters <level>[,<path>]
+ 'stdout';; log to standard output, parameters <level>
+ 'stderr';; log to standard error, parameters <level>
-*-s|--command-sock <unix sock>*::
+*-s|--command-sock '<unix sock>'*::
*rhdropbox* will listen on this unix socket for incoming commands. See next
chapter for details. The default is /var/run/rhdropbox/cmd.sock
-*-x|--script <script>*::
+*-x|--script '<script>'*::
The script which should be called when a new file is found. The following parameter
are passed to the scipt:
- *<path>*;; the path to the folder containing the new file
- *<filename>*;; the name of the new file relative to <path>
- *<filesize>*;; the size of the file right after the event was received, this can be
+ '<path>';; the path to the folder containing the new file
+ '<filename>';; the name of the new file relative to <path>
+ '<filesize>';; the size of the file right after the event was received, this can be
used to determine wheter the file is complete. The script should
consider a file to be complete when it size doesn't change 3-5seconds
after the event got received.
-*-m|--max-children <#of children>*::
+*-m|--max-children '<#of children>'*::
Limits the total concurrent executions of *-x|--script*. A value of 0 means no limit.
+*-d|--dir '<path>'*::
+ Add '<path>' to the watch list. This can be invoked serveral times.
+
COMMAND INTERFACE
-----------------
diff --git a/options.c b/options.c
index d567891..6298f9d 100644
--- a/options.c
+++ b/options.c
@@ -175,6 +175,7 @@ int options_parse(options_t* opt, int argc, char* argv[])
PARSE_STRING_PARAM("-s","--command-sock", opt->command_sock_)
PARSE_STRING_PARAM("-x","--script", opt->script_)
PARSE_INT_PARAM("-m","--max-children", opt->max_children_)
+ PARSE_STRING_LIST("-d","--dir", opt->dirs_)
else
return i;
}
@@ -215,6 +216,7 @@ void options_default(options_t* opt)
opt->command_sock_ = strdup("/var/run/rhdropbox/cmd.sock");
opt->script_ = strdup("newfile.sh");
opt->max_children_ = 8;
+ string_list_init(&opt->dirs_);
}
void options_clear(options_t* opt)
@@ -238,6 +240,7 @@ void options_clear(options_t* opt)
free(opt->command_sock_);
if(opt->script_)
free(opt->script_);
+ string_list_clear(&opt->dirs_);
}
void options_print_usage()
@@ -255,6 +258,7 @@ void options_print_usage()
printf(" [-s|--command-sock] <unix sock> the command socket e.g. /var/run/rhdropbox/cmd.sock\n");
printf(" [-x|--script] <script> the command socket e.g. newfile.sh\n");
printf(" [-m|--max-children] <#of children> limit of children to be started e.g. 8\n");
+ printf(" [-d|--dir] <path> add a path to the watch list, can be invoked several times\n");
}
void options_print(options_t* opt)
@@ -274,4 +278,5 @@ void options_print(options_t* opt)
printf("command_sock: '%s'\n", opt->command_sock_);
printf("script: '%s'\n", opt->script_);
printf("max_children: %d\n", opt->max_children_);
+ string_list_print(&opt->dirs_, " '", "'\n");
}
diff --git a/options.h b/options.h
index b29fa96..e98655b 100644
--- a/options.h
+++ b/options.h
@@ -36,6 +36,7 @@ struct options_struct {
char* command_sock_;
char* script_;
int max_children_;
+ string_list_t dirs_;
};
typedef struct options_struct options_t;