You already have a script that's being executed every time someone logs in:
You can modify that script to perform whatever task it is that you have in mind, or have it call your script directly. On Debian derivatives, you can just drop your custom script (ending in
/etc/profile.d and it will be called automatically.
NOTE: Everything I just said only applies to Bourne shell derivatives, like the default
/bin/sh, ash, bash, ksh, etc. Most users stick with bash, so the above directions are likely all you need. Other families of shells use other startup scripts. Tcsh, for example, will execute
/etc/csh.cshrc on login.