Reboot script

can some one help me…i have script to divide speed by active users…my problem is if any user leave …the old division still work..i want if any user leave the speed should redivide on the current active