Which other part is the same? The way that script works is it checks the value of $1
, which is the first parameter to the script supplied on the command-line. If it's 'start', then the part after start)
is executed. If it's 'stop', then the part after stop)
is executed. If it's 'restart', then the part after restart)
is executed.
Line by line for that first part:
#! /bin/sh
Hey, it's a shell script! Specifically, execute this script using the sh
shell.
test –f /usr/bin/sshd || exit 0
Is there a file called /usr/bin/sshd
? If not, exit with a 0 return status.
case “$1” in
Check the value of $1
, the first command-line option.
start)
If $1
is 'start'...
echo –n “Starting sshd: sshd”
Print "Starting sshd: sshd
".
/usr/sbin/sshd
Execute /usr/sbin/sshd
.
echo “.”
Print ".
".
;;
Exit the case
statement.