- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Restricting user to login after there shift
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-16-2011 11:24 AM - edited 08-16-2011 11:26 AM
08-16-2011 11:24 AM - edited 08-16-2011 11:26 AM
Re: Restricting user to login after their shift
WDAY=$(date "+%w") # 0-Sunday, 6=Saturday
HOUR=$(date "+%H")
Pedantic mode on:
Decades ago starting my first programming job, one of the first things I learned from an old timer is that you never want to ask for the time & date with two calls. I.e. the first could be right before midnight.
You could also ask for WDAY again (especially if you have a broken OS that doesn't give you both at the same time) and compare, assuming the process didn't hang for 24 hours. ;-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2011 11:39 AM
08-16-2011 11:39 AM
Re: Restricting user to login after their shift
@Dennis Handly wrote:WDAY=$(date "+%w") # 0-Sunday, 6=Saturday
HOUR=$(date "+%H")
Pedantic mode on:
Decades ago starting my first programming job, one of the first things I learned from an old timer is that you never want to ask for the time & date with two calls. I.e. the first could be right before midnight.
Well, that's not so pedanitc :-) It's the same consideration we give to avoiding race conditions.
I would do better if I had done:
DATETIME=$(date "+%w":%H) WDAY=$(echo ${DATETIME}|cut -d":" -f1) HOUR=$(echo ${DATETIME}|cut -d":" -f2)
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2011 10:36 PM
08-16-2011 10:36 PM
Re: Restricting user to login after their shift
Hi,
How can I make an entry in /etc/profiles because we have different groups of users and their login time are different for each groups and its user. I would like to make the restriction on groups basis since numbers of users is also very high, so it will be very difficult to make an entry in .profile of each users. So I would like to make the restriction for each groups having different working time and day.
So if I make an entry in /etc/profile it will effect all users. Right?
Appreciate you people all help.
Regards
Syed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2011 02:10 AM - edited 08-17-2011 02:11 AM
08-17-2011 02:10 AM - edited 08-17-2011 02:11 AM
Re: Restricting user to login after their shift
>I would like to make the restriction on groups basis since numbers of users is also very high, so it will be very difficult to make an entry in .profile of each users. So I would like to make the restriction for each groups having different working time and day.
If each set of users is in a different Unix group, you can check that.
case $(id -ng) in
group1) check limits ... # insert logic from JRF's example
;;
group2) check limits ...
;;
*) # These are unlimited
;;
esac
>So if I make an entry in /etc/profile it will effect all users?
Only the ones you want it to do so.
- « Previous
-
- 1
- 2
- Next »