Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi
I am using ubuntu linux. I have created a new account for my nephew (for his college assignments). How can I make this account that I can only be loggedin during 6PM and 9PM, except these timings, this (new) account cannot be logged in?
Regards
Thanks. timekpr solved the problem.
Another question arises, if the user is already logged in then after the expiry time, the session would logged out automatically or is there any other way to force user to logout after expiry of time?
Dunno. While skimming the link I read something about a warning when overextending the login period or before that happens. But if it was with timkpr or someother mentioned tool I don't know.
Check out the config file of timekpr and see if it got some options for kinda like that.
Dunno. While skimming the link I read something about a warning when overextending the login period or before that happens. But if it was with timkpr or someother mentioned tool I don't know.
Check out the config file of timekpr and see if it got some options for kinda like that.
While you were writing your answer, I have found a way and that is to create a cron job with following:
0 21 * * * /sbin/shutdown -h now
Last edited by zetrotrack000; 10-23-2013 at 09:59 AM.
This for sure gets the server down but there might be occasion where the login period should be extended maybe cause all it takes are five minutes more to finish something. Right now this is not possible.
Maybe first see if someone is still logged in using who or w command. Then send a message to those users and check again in 5-10minutes then issue a second warning and after 2 minutes shutdown for sure.
Code:
if [ $(who | wc -l) -gt 0 ]; then
echo "sending message"
fi
sleep 300
if [ $(who | wc -l) -gt 0 ]; then
echo "sending message"
fi
shutdown +2
Something like this. Checking if a user is logged in might go in a function maybe.
Sending the message has to be evaluated again. On command line shutdown will take care of telling the user about going down. Dunno what about a GUI. Guess that depends on the window manager in use but most recent ones have some kind of notification ability.
... On command line shutdown will take care of telling the user about going down. Dunno what about a GUI. Guess that depends on the window manager in use but most recent ones have some kind of notification ability.
This is a problem I have considered. There are some GUI notification popups available, but I haven't found one that will stay visible on top when the user is busily using the keyboard or mouse, as might happen when he is playing a video game. The notification either gets buried when the user clicks on another window, or it dismisses itself when it receives keyboard or mouse clicks that were intended for the user's application.
One option in the gnome environment is to put a notification applet on the gnome panel. Then it would remain visible until the user clicks on gnome panel to dismiss it. It could even show the remaining time like a countdown timer, and change color when it reaches a critical level like 5 minutes remaining. I had hoped to develop such a gnome-panel applet, it doesn't look difficult, but I got distracted with other work. Does anyone know of a gnome-panel notification applet that's already available?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.