Notification Script Not Working

Ask for help and report issues with the Mac OS X version of Transmission
Post Reply
typkrft
Posts: 2
Joined: Tue Jan 26, 2016 7:37 pm

Notification Script Not Working

Post by typkrft »

I have a shell script named notify.sh. The purpose if you cannot tell, is to display a pop up notification on another computer. This works when typed into terminal, with the exception that there is no torrent name as it's not defined. I have ssh keys setup so there is no need to expect a password, unless there is something I don't know about shell scripts. The script is placed in a folder with read and write permissions on an external hdd. The scripts permissions are :

Code: Select all

-rwxr--r--  1 typkrft  staff  143 Jan 26 12:18 Notify.sh
The directory's permissions are:

Code: Select all

drwxrwxrwx  12 typkrft  staff   408 Jan 26 12:18 Transmission Scripts
The Code is as follows:

Code: Select all

#!/bin/sh

ssh typkrft@192.168.0.2 'osascript -e "display notification "'"$TR_TORRENT_NAME"'" with title \"Media Server\" sound name \"Pop\""'
Any help would be greatly appreciated.
typkrft
Posts: 2
Joined: Tue Jan 26, 2016 7:37 pm

Re: Notification Script Not Working

Post by typkrft »

I Figured it out. I wasn't passing variables correctly.

Just in case someone else wants the working code, here it is:

Code: Select all

#!/bin/sh
#replace <someText> with the variable. eg. "<environmentalVariable>" >> "$TR_TORRENT_NAME". 

ssh <username>@<ip> osascript <<EOF
display notification "<environmentalVariable>" with title "<titleOfNotification>" sound name "<soundOfNotification>"
EOF
Post Reply