The session's name is Ubuntu and not unity, I tried to change its name to "Unity" but the globalmenu stopped working after doing so.
I've modified the script to send a massage after it is correctly executed. Please, be sure to install unity before running the script: $ sudo apt-get install unity