- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- executing scripts upon user logout
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2013 01:58 AM - last edited on 08-26-2013 06:54 PM by Liuqing
08-26-2013 01:58 AM - last edited on 08-26-2013 06:54 PM by Liuqing
executing scripts upon user logout
Hi Gurus ,
My requirement is to find the list of modified files , between the time a user login and log out.
If login time and log out time is known , we can run find and get the list of modified files , again a user id.
Is there a way to accomplish this upon user exit , using tools like tripwire seems like and over kill .
Regards,
P.S. This thread has been moved from HP-UX > System Administration to HP-UX > languages.
-HP Forum Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2013 02:16 AM - edited 08-27-2013 12:23 AM
08-26-2013 02:16 AM - edited 08-27-2013 12:23 AM
Re: executing scripts upon user logout (trap arg EXIT)
What shell is being used? A real shell or the scummy C shell?
Are you just looking at the files under the home directory or all of the filesystems?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2013 05:35 AM
08-26-2013 05:35 AM
Re: executing scripts upon user logout
Hi Dennis ,
lokking for non vg00 fs and user shell is /sbin/sh.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2013 03:26 PM
08-26-2013 03:26 PM
Re: executing scripts upon user logout
You could insert a suitable 'trap' statement in your /etc/profile that will perform the task you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2013 06:04 PM
08-26-2013 06:04 PM
Re: executing scripts upon user logout
How much storage are you going look through? A small server with a few gigabytes will take a trivial amount of time. But HP-UX can easily be connected to petabytes of storage with billions of files, so the find command must be carefully designed to only look where the user has write capability. If the user is not restricted and there are millions of files to search, each exit might require an hour of intense disk activity.
Before designing the script, try find with selected directories and -mtime to find files changed in the last day or two, or for finer resolution, use the -newer option and a reference file. NOTE: if any of these users are sharing the same login, or worse, the user(s) have a root user UID, the find results will be only slightly useful.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2013 12:23 AM
08-27-2013 12:23 AM
Re: executing scripts upon user logout (trap arg EXIT)
>between the time a user login and log out. If login time and log out time is known
It would be simpler to create a reference file when you login. This can be done in your ~/.profile.
Then you can just can just use:
find fs1 fs2 ... -newer ~/.ref-file
You may want to see if the user removed the ~/.ref-file. If this can happen, you would have to convert the login time to the touch command syntax to create the ref file.
Note: This is all modified files, no matter which user.
>You could insert a suitable 'trap' statement in your /etc/profile that will perform the task you want.
(This can also be put into each ~/.profile.)
trap "command any-parms" EXIT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2013 10:59 PM
08-28-2013 10:59 PM
Re: executing scripts upon user logout (trap arg EXIT)
Thank you Dennis , RJHALL and Bill ,
I setteled for a script -a file_name ,in .profile of the user , though upon login they will be aware of the same.
Regards,