When a manual invocation of
service runs a SysV style script from /etc/init.d or /etc/rc.d, all status output depends entirely on that script.
Properly written init.d scripts will use a library of shell functions provided by the distro. For example, in Debian, most scripts will load (source) the file
/lib/lsb/init-functions, and simply call its provided functions like this:
case "$1" in
log_daemon_msg "Starting $DESC" "$NAME"
case "$?" in
0|1) log_end_msg 0 ;;
2) log_end_msg 1 ;;
Here's the list of standard functions defined by LSB. (Note that distros may provide additional functions beyond the standard, as the example above. Also note that e.g. OpenRC or Arch Linux aren't LSB-compatible and use entirely different styles.)
In fact, some distros will provide this boilerplate code centrally as well, and all that's left to the init.d script is to implement
do_start. (See Gentoo's OpenRC and Debian's
/lib/init/init-d-script as examples). However, that's not a "standard" LSB feature – scripts trying to be LSB-compatible still have to do it manually.
Note: I emphasize 'Properly written' because really there's nothing that would force an init.d script to use these functions, other than human supervision. If the script wants to report status via plain
echo (or via
cowsay for that matter), it is always able to do that. This is especially a problem with commercial software distributed outside the normal channels: their status output never looks quite right (and frankly, the whole init.d script never behaves quite right).
Meanwhile, when SysV scripts are called during the boot process, the result is even more distro-dependent – sometimes you'll see output directly from the scripts themselves, but sometimes the "main" init system will provide its own status output for all services it starts. (Example: Arch Linux's old initscripts, when starting a service in background.)
But your 2nd example is actually not a SysV style init – it's systemd (which just happens to be starting a 'legacy' init.d script in your example). Systemd is a full service manager which uses service configurations (not scripts), and therefore all boot/shutdown status output is provided by systemd itself. This also applies to most other "service managers", including init-ng, SMF, or Upstart.