How do I run a terminal script when mounting a specific disk?
Ok as per all the suggestions the users gave I googled and found a nice .plist file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.company.popup</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>/usr/local/bin/backup</string>
</array>
<key>StartOnMount</key>
<true/>
</dict>
</plist>`
I have put this code under ~/Library/LaunchAgents and runs at login.Thanks for all your replies again it helped me find a better code.