Simon icon Simon
Flexible server monitoring

Using Terminal & Notifier to send a command to a remote server

This Notifier Applescript will execute a command on a remote server via Terminal. I have created a script on the remote server that will execute a restart.

I set out to write an Applescript that would launch Terminal and login via ssh then execute the command and quit. It crossed my mind that I leave Terminal open and am logged in 24/7 so all I needed was to send the command which avoids messy pauses/waits and conditionals.

This Applescript requires you to log in to Terminal and leave it open.

In Notifier double click on Apple Script and paste in the script, save. Double click the test you are running, select failure & Apple Script. Set the test frequency and timeout duration for failure under Options.

tell application "Terminal"
do script "XXXXX" in window 1
end tell

where "XXXXX" is your command to the server.