I recall prepending a nohup: root@debian$ nohup invoke-rc.d xdm stop solved the problem. So maybe a nohup or trap inside /etc/init.d/xdm would be what you want. The only problem left then would be cleaning up the nohup.out created. This could also be done for other /etc/init.d/?dm's.