id | grep "uid=0(root)" > /dev/null || {                                      
        if [ -f /etc/nologin ]; then                                          
                cat /etc/nologin                                              
                exit 1                                                        
        fi                                                                    
}    
#

Add the following routine to /etc/.login:-
                                                                        
#                                                                             
# check for nologin                                                           
#                                                                             
id | grep "uid=0(root)" > /dev/null                                           
if ( $status ) then                                                           
        if ( -f /etc/nologin ) then
                cat /etc/nologin
                logout
        endif
endif


