jeudi 5 novembre 2015

If-else statement - read if server is on or off

I would like to keep my remotelogin to always be "On". In this case, a .plist is called and runs a shell script (the one above) to see if RemoteLogin is Off, if so then run the following two commands; else, exit 0.

Is there something I'm missing here? Maybe "Off" needs to be replace with 0?

if [ `sudo systemsetup -getremotelogin` = "Off" ]; then

sudo systemsetup -setremotelogin on
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist

else 

exit 0

fi

Aucun commentaire:

Enregistrer un commentaire