log off all users from the server

log off all users from the server

Post by ici » Tue, 24 Jul 2001 08:41:28



I 'm admin unix junior ,and I want write a script batch to log off all users
from the server ,but before ,send to them a message informe them to save
data because the session gonna close

Please some suggestion

Thanks foe your help

 
 
 

log off all users from the server

Post by Juergen P. Mei » Tue, 24 Jul 2001 17:58:34



>I 'm admin unix junior ,and I want write a script batch to log off all users
>from the server ,but before ,send to them a message informe them to save
>data because the session gonna close

>Please some suggestion

>Thanks foe your help

echo "Log off now or risk data loss!" | wall
echo "You cannot login now. Try again later!" >/etc/nologin
sleep 300 # 5 minutes
echo "You will now be thrown out!" | wall
init S

note: The init S should work on all modern unix systems with sysV style
init. It turns the system into single-user mode, killing all login processes
and shutting down networking.

If you just want to kill every interactive user process, you would have
to parse the output of ps, looking for processes owned by users and attached
to a tty. A good thing is to first send them the HUP signal, wait a few
seconds, then send the TERM signal, and after another short time, the KILL
signal.

See manpages: ps kill init wall nologin and sed, awk, grep and cut

HTH
Juergen
--


 
 
 

log off all users from the server

Post by Bill Marcu » Tue, 24 Jul 2001 23:35:18



>I 'm admin unix junior ,and I want write a script batch to log off all
users
>from the server ,but before ,send to them a message informe them to save
>data because the session gonna close

>Please some suggestion

man shutdown