Hello
7 years later I've faced the same problem.
This is how script should start nfcapd:
+ start-stop-daemon --start --quiet --pidfile /var/run/nfcapd.pid --exec /usr/bin/nfcapd -- ... -x '/root/nfrotate-args %f'
If we check command line in /proc/<pid>/cmdline, we can see:
00 2D 78 │ 00 2F 72 6F │ 6F 74 2F 6E │ 66 72 6F 74 │ 61 74 65 2D | 61 72 67 73 │ *20* 25 66 00 || -x./root/nfrotate-args %f. "0x00" is the delimiter between args, 0x20 (space) is the delimiter between command and arguments for -x option

Default init script does this:
DAEMON_ARGS=" ... -x '/root/nfrotate-args %f'"

+ start-stop-daemon --start --quiet --pidfile /var/run/nfcapd.pid --exec /usr/bin/nfcapd -- ... -x ''\''/root/nfrotate' '%f'\'''
From /proc:
2D 78 │ 00 27 2F 72 │ 6F 6F 74 2F │ 6E 66 72 6F │ 74 61 74 65 | 2D 61 72 67 │ 73 *00 *25 66 │ 27 00 || -x.'/root/nfrotate-args.%f'. Delimiter between command and argument - 0x00, not 0x20, so nfcapd does not see %f, and it thinks it does not belong to -x option

I'm not very good at init scripts, so the only way I've found is add options in default file for command and it's arguments.












--- /etc/default/nfdump.old     2014-05-06 10:11:34.115628154 +0600
+++ /etc/default/nfdump 2014-05-06 10:13:00.572421179 +0600
@@ -2,3 +2,5 @@
 nfcapd_start=yes
 
 DAEMON_ARGS=" -l /srv/nflow/ -T all -S 1 -t 60 -D -P /var/run/nfcapd.pid -w"
+PROCESS_SCRIPT=""
+PROCESS_ARGS=""
--- /etc/init.d/nfdump.orig     2014-05-06 10:14:32.357509577 +0600
+++ /etc/init.d/nfdump  2014-05-06 10:14:56.630855246 +0600
@@ -53,9 +53,16 @@
        #   2 if daemon could not be started
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON 
--test > /dev/null \
                || return 1
-       start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
-               $DAEMON_ARGS \
-               || return 2
+       if [ x"$PROCESS_SCRIPT" = x ]
+       then
+               start-stop-daemon --start --quiet --pidfile $PIDFILE --exec 
$DAEMON -- \
+                       $DAEMON_ARGS\
+                       || return 2
+       else
+               start-stop-daemon --start --quiet --pidfile $PIDFILE --exec 
$DAEMON -- \
+                       $DAEMON_ARGS -x $PROCESS_SCRIPT\ $PROCESS_ARGS\
+                       || return 2
+       fi
        # Add code here, if necessary, that waits for the process to be ready
        # to handle requests from services started subsequently which depend
        # on this one.  As a last resort, sleep for some time.

Reply via email to