For my application, I need to cut off the USB power at the earliest possible stage. Right now it starts early in init.d but I would like it, if possible, to start before the init.d stuff starts. I read somewhere that Linux normally calls /sbin/init after it boots the kernel. I looked at that file and I only calls this binary "/lib/systemd/systemd" Is this the case for Raspi as well? Can I put stuff right before or after that line?
I did:
journalctl -u disableusb.service
No journal files were found.
And yes, I did a sudo systemctl enable disableusb
before. And it said it created a link to it.
pi@raspberrypi:~$ systemd-analyze
Startup finished in 3.312s (kernel) + 14.995s (userspace) = 18.308s
multi-user.target @14.786s
└─getty.target @14.767s
└─[email protected] @14.733s
└─systemd-user-sessions.service @13.720s +251ms
└─network.target @13.142s
└─dhcpcd.service @11.656s +1.249s
└─basic.target @11.571s
└─timers.target @11.552s
└─systemd-tmpfiles-clean.timer @11.551s
└─sysinit.target @11.522s
└─networking.service @7.911s +3.569s
└─local-fs.target @7.757s
└─boot.mount @7.503s +162ms
└─[email protected] @7.195s +248ms
└─dev-mmcblk0p6.device @7.166s
/etc/init.d
is only around for backward compatibility (and possible cross compatibility with other *nixes). The best opportunity for fine tuning is, as Aurora0001 indicates, using systemd facilities.