Cannot use all the weekly timeslot selected

Asked by Prateek Fulzele

Hi there,

I have the latest version of the application (2.10) running on my XUbuntu desktop. Initially I configured weekly schedule with couple of days using the GUI and once I understood how the app works, I added schedule for rest of the week, again using the GUI. But then the set schedules were not working, including the old ones. So I manually modified the user config file /var/lib/timekpr/config/timekpr.<user id>.conf. Now the app is letting user access his desktop on certain set schedule on some days, but not on other days. See the config file attached below.

So, I want to find out

(1) if the app caches the config after reading it from the user config file, and if that's the case, is there a way to delete that cache so that it can pick up the updated config in the text format?

(2) Also, does the app log error somewhere for debugging purpose? I want to make sure the app is able to read the user config in the text format I am using.

Thanks.

prateek@aruba:~/stuff$ cat /var/lib/timekpr/config/timekpr.nitin.conf
[DOCUMENTATION]
#### this is the user configuration file for timekpr-next
#### if this file can not be read properly, it will be overwritten with defaults

[nitin]
# this defines which hours are allowed (remove or add hours to limit access), configure limits for start/end minutes for hour in brackets, example: 22[00-15]
ALLOWED_HOURS_1 = 17[30-60];18[0-15]
ALLOWED_HOURS_2 = 17[30-60];18[0-15];22[0-30]
ALLOWED_HOURS_3 = 17[30-60];18[0-15]
ALLOWED_HOURS_4 = 17[30-60];18[0-15]
ALLOWED_HOURS_5 = 17[30-60];18[0-15]
ALLOWED_HOURS_6 = 10;11
ALLOWED_HOURS_7 = 10;11
# this defines which days of the week a user can use computer (remove or add days to limit access)
ALLOWED_WEEKDAYS = 1;2;3;4;5;6;7
# this defines allowed time in seconds per week day a user can use the computer
LIMITS_PER_WEEKDAYS = 2700;2700;2700;2700;2700;7200;7200
# this defines allowed time per week in seconds (in addition to other limits)
LIMIT_PER_WEEK = 604800
# this defines allowed time per month in seconds (in addition to other limits)
LIMIT_PER_MONTH = 2678400
# this defines whether to account sessions which are inactive (locked screen, user switched away from desktop, etc.)
TRACK_INACTIVE = False

Question information

Language:
English Edit question
Status:
Solved
For:
Timekpr-nExT Edit question
Assignee:
Eduards Bezverhijs Edit question
Last query:
Last reply:
Revision history for this message
Eduards Bezverhijs (mjasnik) said :
#1

If You edit config via the app, changes are applied immediately, when using file editing manually, it will be applied after 30 seconds. What You need to do in the app is always press apply or set, otherwise config is not saved.
Anyhow, it should work regardless according to configuration.

As I see configuration is very restrictive, on working days it's just from 17:30 to 18:15, which is 45 minutes. Is user able to log in at that time?

If You say app is complicated, maybe I need to make "easy config" tab, where one can specify times for working days and holidays separately, it may help probably.

By default timekpr is logging quite a lot, You can check /var/log/timekpr.log and if You still have problems, please zip the log and send it to me via e-mail. Then I'll be able to check what is wrong.

Revision history for this message
Prateek Fulzele (prateekf) said :
#2

Hi Eduards,

Thanks for the reply. After reading your message, I think I was able to save config properly.

But now I wonder if the time limit of 45 mins is too short for the application to apply ? I really wanted user
to stick to the 45 mins. But as you can see from the log I just collected, the user was not able to log in. The
user session starts at 17:30 (05:30 PM). But when user tried to log in, the app calculated that there is no time
left for the user, and exited him.

Is there minimum time period the application expects? Or why does application think that there is no time
left for the user, even though I had set it from 17:30 to 18:15

See the config from my first message:
ALLOWED_HOURS_2 = 17[30-60];18[0-15];22[0-30]

I can send you the log in the zip format if needed.

Thanks,
Prateek

from /var/log/timekpr.log:

2020-01-28 17:31:47.842065: start adjustTimeSpentActual
2020-01-28 17:31:47.842181: ---=== start isUserActive for "nitin" ===---
2020-01-28 17:31:47.843008: user stats, state: active, idleState: False
2020-01-28 17:31:47.843504: ['x11', 'wayland', 'mir']
2020-01-28 17:31:47.843633: got 1 sessions, start loop
2020-01-28 17:31:47.843746: session cached: c10
2020-01-28 17:31:47.845268: got session - type: x11, VTNr: 8, state: active, idle: False
2020-01-28 17:31:47.845388: session /org/freedesktop/login1/session/c10 active
2020-01-28 17:31:47.845500: ---=== finish isUserActive: True ===---
2020-01-28 17:31:47.845619: finish adjustTimeSpentActual
2020-01-28 17:31:47.845761: start getTimeLeft
2020-01-28 17:31:47.845984: user: nitin, timeLeftToday: 0, timeLeftInARow: 0, timeSpentThisBoot: 15.0, timeInactiveThisBoot: 0
2020-01-28 17:31:47.846093: start processTimeLeft
2020-01-28 17:31:47.846295: time left: 0; 0; 2700, notification lvl: 5, priority: critical, force: False
2020-01-28 17:31:47.846406: finish processTimeLeft
2020-01-28 17:31:47.846508: finish getTimeLeft
2020-01-28 17:31:47.846611: user "nitin", active: True, time left: 0
2020-01-28 17:31:47.846713: finish checkUsers
2020-01-28 17:31:47.846813: --- end working on users ---
2020-01-28 17:31:48.003530: start user killer
2020-01-28 17:31:48.003743: death approaching in 1 secs
2020-01-28 17:31:48.003867: sending tcn: 1
2020-01-28 17:31:48.004052: finish user killer
2020-01-28 17:31:49.004003: start user killer
2020-01-28 17:31:49.004256: death approaching in 0 secs
2020-01-28 17:31:49.005719: sending tcn: 0
2020-01-28 17:31:49.005894: start saveSpent
2020-01-28 17:31:49.006060: start save user (nitin) control
2020-01-28 17:31:49.006786: finish save user control
2020-01-28 17:31:49.007002: finish saveSpent
2020-01-28 17:31:49.007140: start terminateUserSessions
2020-01-28 17:31:49.007252: inspecting "nitin" userpath "/org/freedesktop/login1/user/_1001" sessions
2020-01-28 17:31:49.012904: INFO: switching TTY to 7
2020-01-28 17:31:49.013556: (delayed 1 sec) killing "nitin" session /org/freedesktop/login1/session/c10 (x11)
2020-01-28 17:31:49.014083: INFO: (forced) switching TTY to 7
2020-01-28 17:31:49.015391: finish terminateUserSessions
2020-01-28 17:31:49.015482: finish user killer
2020-01-28 17:31:50.847995: --- start working on users ---
2020-01-28 17:31:50.848244: start checkUsers
2020-01-28 17:31:50.848355: start getUserList
2020-01-28 17:31:50.848978: userid: prateek
2020-01-28 17:31:50.849094: USERID: 1000
2020-01-28 17:31:50.849199: USERNAME: prateek
2020-01-28 17:31:50.849305: USERPATH: /org/freedesktop/login1/user/_1000
2020-01-28 17:31:50.849410: finish getUserList
2020-01-28 17:31:50.849544: NOTE: user "nitin" has gone
2020-01-28 17:31:50.849650: start saveSpent
2020-01-28 17:31:50.849804: start save user (nitin) control
2020-01-28 17:31:50.850527: finish save user control
2020-01-28 17:31:50.850748: finish saveSpent
2020-01-28 17:31:50.850915: de-init user configuration manager
2020-01-28 17:31:50.851027: de-init user control

Revision history for this message
Eduards Bezverhijs (mjasnik) said :
#3

Well, as I said changes should be applied immediately. Other thing that could happen is that the user already spent the time beforehand, for instance You configured it eralier and tested or smth in that particular day. Did You alter the time files as well?
It maybe a bug too.
Full log file would be the best and all in /var/lib/timekpr as well, so I can reproduce it locally.

Revision history for this message
Eduards Bezverhijs (mjasnik) said :
#5

Can I suggest that user can have 24hrs a day time limit, but intervals stay the same as it's now?
That will still enable 45m a day as You configured right now. Actually that was the intended way of using timekpr-next - either limit that to n hours a day, like user can use computer for 4h a day from 9:00 to 20:00, or leave timelimit for whole day and limit only the time frames / intervals.

Pls report back whether this solves Your issue.

Revision history for this message
Prateek Fulzele (prateekf) said :
#6

Hi Eduards.

I followed your instruction on setting the 24hrs a day limit, but it still didn't work. I have opened a bug to submit my config and logs:

https://bugs.launchpad.net/timekpr-next/+bug/1861758.

Revision history for this message
Eduards Bezverhijs (mjasnik) said :
#7

Done with question, appears to be a bug.

Revision history for this message
Prateek Fulzele (prateekf) said :
#8

Thanks a lot. I see the fix available in version 0.2.11.

Revision history for this message
Eduards Bezverhijs (mjasnik) said :
#9

Since some time passed by, at thos point please install latest normal version, it contains a couple of bugfixes more.