Logging out a user account within a script
Hi there --
I am writing a shell script that will do a snapshot of a local hard drive, but there is a need for all users to be logged off when the script is run. This is due to the user accounts being NIS, and the home directories in question are NFS mounts which are supposed to be unmounted prior to the snapshot being made. What would the correct syntax be in order to accomplish this? One idea that I had was the following: Code:
# su - <user> |
Quote:
That won't work. At best, it will just create a new login shell for the given user and just log out of that shell. If you have text-mode users, I would first ask the users to log out, then wait for a length of time: Code:
echo "Please log out to unmount all NIS accounts" | wall Code:
who -lH Code:
kill -HUP pid |
To check for logged in users/open files, look at
fuser lsof |
All times are GMT -5. The time now is 01:50 AM. |