If you get something like the following error:

when you try to execute something like this:

sudo apt-get remove nginx -yf

Then you need to add exit 0 to the second line of your /etc/init.d/nginx file.

Pure hackery but it works.