Actually what looks to be happening is that /etc/default/apache-htcacheclean is being included/sourced after DAEMON_ARGS has already been set. The init script sets some HTCACHECLEAN_* variables, then DAEMON_ARGS, and then eventually /etc/default/apache-htcacheclean is sourced. However, DAEMON_ARGS is never reset using the newly sourced ENV vars so they're never used (see bash -x debug output below).
As a workaround, instead of changing init script, you can also add DAEMON_ARGS to bottom of your /etc/default/apache-htcacheclean. Here's my DAEMON_ARGS, which I took directly from the init script:
(DAEMON_ARGS is never changed and it has the arguments to start the daemon)
$ dpkg -l | grep apache2
ii apache2 2.4.18-2ubuntu3.4 amd64 Apache HTTP Server
ii apache2-bin 2.4.18-2ubuntu3.4 amd64 Apache HTTP Server (modules and other binary files)
ii apache2-data 2.4.18-2ubuntu3.4 all Apache HTTP Server (common files)
ii apache2-utils 2.4.18-2ubuntu3.4 amd64 Apache HTTP Server (utility programs for web servers)
Actually what looks to be happening is that /etc/default/ apache- htcacheclean is being included/sourced after DAEMON_ARGS has already been set. The init script sets some HTCACHECLEAN_* variables, then DAEMON_ARGS, and then eventually /etc/default/ apache- htcacheclean is sourced. However, DAEMON_ARGS is never reset using the newly sourced ENV vars so they're never used (see bash -x debug output below).
As a workaround, instead of changing init script, you can also add DAEMON_ARGS to bottom of your /etc/default/ apache- htcacheclean. Here's my DAEMON_ARGS, which I took directly from the init script:
DAEMON_ ARGS="$ HTCACHECLEAN_ OPTIONS \ HTCACHECLEAN_ DAEMON_ INTERVAL \ HTCACHECLEAN_ PATH \ HTCACHECLEAN_ SIZE"
-d$
-P$PIDFILE -i \
-p$
-l$
Snippet of bash -x /etc/init. d/apache- htcacheclean start: SIZE=300M DAEMON_ INTERVAL= 120 PATH=/var/ cache/apache2/ mod_cache_ disk OPTIONS= -n /var/run/ apache2/ www-data /var/run/ apache2/ www-data/ apache- htcacheclean. pid run/apache2/ www-data/ apache- htcacheclean. pid -i -p/var/ cache/apache2/ mod_cache_ disk -l300M' htcacheclean apache2/ www-data/ apache- htcacheclean. pid ']' apache2/ www-data/ apache- htcacheclean. pid ']' htcacheclean ']' htcacheclean ']' apache- htcacheclean ']' apache- htcacheclean MODE=daemon SIZE=64M DAEMON_ INTERVAL= 15 PATH=/dev/ shm/htcache OPTIONS= -n cmd_override cmd_override cmd_override apache2/ www-data/ apache- htcacheclean. pid -u www-data --startas /usr/bin/ htcacheclean --name htcacheclean --test
...
+++ HTCACHECLEAN_
+++ HTCACHECLEAN_
+++ HTCACHECLEAN_
+++ HTCACHECLEAN_
+++ PIDDIR=
+++ PIDFILE=
+++ DAEMON_ARGS='-n -d120 -P/var/
++ NAME=apache-
++ DESC='Apache htcacheclean'
++ '[' none = /var/run/
++ '[' -z /var/run/
++ '[' none '!=' /usr/bin/
++ '[' '!' -x /usr/bin/
++ '[' -r /etc/default/
++ . /etc/default/
+++ HTCACHECLEAN_
+++ HTCACHECLEAN_
+++ HTCACHECLEAN_
+++ HTCACHECLEAN_
+++ HTCACHECLEAN_
++ . /lib/init/vars.sh
+++ TMPTIME=0
...
...
++ echo ' * Starting Apache htcacheclean' apache-htcacheclean
* Starting Apache htcacheclean apache-htcacheclean
++ COL=
++ call do_start_cmd
++ cmd=do_start_cmd
++ shift
++ is_call_implemented do_start_
++ command -V do_start_
++ do_start_
++ start-stop-daemon --start --quiet --pidfile /var/run/
(DAEMON_ARGS is never changed and it has the arguments to start the daemon)
$ dpkg -l | grep apache2
ii apache2 2.4.18-2ubuntu3.4 amd64 Apache HTTP Server
ii apache2-bin 2.4.18-2ubuntu3.4 amd64 Apache HTTP Server (modules and other binary files)
ii apache2-data 2.4.18-2ubuntu3.4 all Apache HTTP Server (common files)
ii apache2-utils 2.4.18-2ubuntu3.4 amd64 Apache HTTP Server (utility programs for web servers)