HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell scripts
Operating System - HP-UX
1829398
Members
1410
Online
109991
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
04-18-2001 07:16 PM
04-18-2001 07:16 PM
Shell scripts
Hi Experts
I am trying to write a script which calculates the difference between the two dates and gives it as the number of days say for Eg: between today 4/18/01 and 3/18/01 its 30 days.
My aim is to monitor the last login time of a user and compare it with the system date and in case its more than 60 days I want to send a alert saying user has been idle. My client runs a NIS environment and he doesnt havee trusted systems. I have tried writing the following script below, can you pl guide me and let me know if its the correct way?
Thnks in advance
Shiv
_______________________________________________
#! /bin/sh
OL=`TZ=PST+1440 date +%m%d`
TO=`date +%m%d`
LST=`last -1 karin | awk '{print $6}'`
MON=`last -1 karin | awk '{print $5}'`
case $MON in
Jan) MO=01;;
Feb) MO=02;;
Mar) MO=03;;
Apr) MO=04;;
May) MO=05;;
Jun) MO=06;;
Jul) MO=07;;
esac
CK=$MO$LST
echo Last Login Date $CK
if [ $OL -lt $MO ]
then
echo This user has not loged last 60 days;
echo This user has to be deleted ;
else
echo User logged within 60 days;
fi
I am trying to write a script which calculates the difference between the two dates and gives it as the number of days say for Eg: between today 4/18/01 and 3/18/01 its 30 days.
My aim is to monitor the last login time of a user and compare it with the system date and in case its more than 60 days I want to send a alert saying user has been idle. My client runs a NIS environment and he doesnt havee trusted systems. I have tried writing the following script below, can you pl guide me and let me know if its the correct way?
Thnks in advance
Shiv
_______________________________________________
#! /bin/sh
OL=`TZ=PST+1440 date +%m%d`
TO=`date +%m%d`
LST=`last -1 karin | awk '{print $6}'`
MON=`last -1 karin | awk '{print $5}'`
case $MON in
Jan) MO=01;;
Feb) MO=02;;
Mar) MO=03;;
Apr) MO=04;;
May) MO=05;;
Jun) MO=06;;
Jul) MO=07;;
esac
CK=$MO$LST
echo Last Login Date $CK
if [ $OL -lt $MO ]
then
echo This user has not loged last 60 days;
echo This user has to be deleted ;
else
echo User logged within 60 days;
fi
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2001 11:14 PM
04-18-2001 11:14 PM
Re: Shell scripts
You would be better posting this query in the HP-UX forum as this forum is meant for hardware queries.
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2001 12:06 AM
05-17-2001 12:06 AM
Re: Shell scripts
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP