A more general solution is to use pam_script.so in the appropriate /etc/pam.d file adding the line
session required pam_script.so onsessionopen=/etc/yourscript.sh
This will execute the script file on login. You can use this hook to grab logins to any service that uses pam for authentication which includes most non-vhost services on linux.