Question 14 of 135 from exam XK0-004: CompTIA Linux+

Question 14 of 135 from exam XK0-004: CompTIA Linux+

Question

A networked has been crashing intermittently.

A Linux administrator would like to write a shell script that will attempt to ping the server and email an alert if the server fails to respond.

The script will later be scheduled via cron job.

Which of the following scripts would BEST accomplish this task? A.

SERVER="'192.168.1.50'"

RESULT="ping -C 2 §

att!

‘SULT ]; then

echo “Server is down” | mail

“Server down” admin@email_sddress.com

B.

2>/ dev/null

echo “Server is down”

= “Server down” admin@email_address.com

C.

echo “Server is down”

= “Server down” admin@ema:

_address.com

done

C. D.

'192.168.1.507

-c 2 SSERVER >/dev/null 2>/tmp/fe.

-£ /tmp/fail/log ]; then

echo “Server is down” = “Server down” admin@ema:

address.com

Explanations

D.