I'v been trying to understand this code but I couldn't get the whole of it. I got that 'init' is the first startup process and that this program is used to start or end a particular mentioned service. But what does the 'cat' in the 'kill' do ?And what happens in the system internal when this program is start, stop and restart?
#!/bin/sh
test -f /usr/sbin/sshd || exit 0
case "$1" in
start)
echo -n "Starting sshd: sshd"
/usr/sbin/sshd
echo "."
;;
stop)
echo -n "Stopping sshd: sshd"
kill `cat /var/run/sshd.pid`
echo "."
;;
restart)
echo -n "Stopping sshd: sshd"
kill `cat /var/run/sshd.pid`
echo "."
echo -n "Starting sshd: sshd"
/usr/sbin/sshd
echo "."
;;
*)
echo "Usage: /etc/init.d/sshd start|stop|restart"
exit 1
;;
esac