Hi,
I really need help with the creation of a script to allow access for timed intervals of 30 mins on a Guest account and since I am a complete beginner with scripting I hope the community can lend a generous hand with the development of said script.
Here's the story, I have recently refurbished a computer and installed Linux Mint 11 with very few noticeable issues. I created a Guest account for use by my clients to check email or edit some documents but the only problem that remains is the lack of a time limitation to prevent unnecessary extended use. I've Googled my brains out trying to find a viable option but to no avail, the only one that has what I want is http://u-scripts.blogspot.com/2010/03/a ... -kids.html the only dependency is on Conky which is NOT compatible with the new linux mint 11. Here are the minimal parameters for what I'm looking for:
-a simple script that is engaged at login of Guest account
-script logs off only the Guest account after 30 minutes of use
-Does not affect the admin account which will also be engaged for extraneous purposes behind the scenes
-blocks re-login for 5 min (if possible)
For a more advanced version my only hope is for a timer that shows the amount of remaining time.
Time limit on guest account - help needed [solved]
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
Time limit on guest account - help needed [solved]
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Time limit on guest account - help needed
Split from another thread and title edited
- Pilosopong Tasyo
- Level 6
- Posts: 1432
- Joined: Mon Jun 22, 2009 3:26 am
- Location: Philippines
Re: Time limit on guest account - help needed
How about a rough algorithm instead, just to give you a head start?
Then you can set the script to run upon login of the guest account (via Startup Applications). The algorithm satisfies all your requirements (including remaining time notification) except the last one (blocks relogin for 5 minutes -- perhaps a future exercise?). Also note the algorithm doesn't take into consideration if the guest user logs out of the account before his/her alloted time is up. No need for conky either, though you might need to download a small package in order to display on-screen notifications.
Try to understand the logic of the above algorithm. It will help you tremendously if you get the idea how it works. Look up the following for hints as well:
Code: Select all
#!/bin/sh
# Some useful variables
TIME_NOW = current time expressed in seconds
END_TIME = computed ending time (also expressed in seconds)
# Countdown loop
while TIME_NOW < END_TIME
do
# Display a reminder once per minute
REMINDER_FLAG = (END_TIME-TIME_NOW) modulus 60
if REMINDER_FLAG = 0
then
REMAINING_TIME = (END_TIME-TIME_NOW) / 60
display REMAINING_TIME on screen
fi
# Update the current time
TIME_NOW = current time (expressed in seconds)
sleep 1 # Don't hog the CPU!
done
# Time is up!
force logout user
# EOF
Try to understand the logic of the above algorithm. It will help you tremendously if you get the idea how it works. Look up the following for hints as well:
- date
expr
notify-send
pkill / gnome-session-save
o Give a man a fish and he will eat for a day. Teach him how to fish and he will eat for a lifetime!
o If an issue has been fixed, please edit your first post and add the word [SOLVED].
o If an issue has been fixed, please edit your first post and add the word [SOLVED].