Iam want to restart the apache server, when its down.Hence i wrote like script below using curl and some if loop
curl example.com
si='curl example.com'
if test si !=0
then
service apache2 restart
fi
~
I expect to restart apache server, if the site is down
But It returns the following error
url: (7) Failed to connect to example.com port 80: Connection refused
autostart.sh: line 8: test: si: unary operator expected