11-29-2021, 08:45 AM | #1 |
Junior Member
Posts: 9
Karma: 10
Join Date: Nov 2021
Device: BOOX Poke 2
|
Automate Add new users to Server at specific time of the day
I am not sure if this is the place for this topic but I think ill post it here anyway.
As far as I know, calibre-server has to be turned off in order to manage users. I am using ubuntu and ideally I want to put soon-added members at the end of the day because I dont want to stop the server at middle of the day and cant stay awake midnight also. Is it possible to achieve this with bash script? Example: 1AM check if users.txt is empty or not, if not stop calibre-server do a while loop to grab users and passwords from users.txt and add to userdb delete users and passwords start calibre-server Thank you very much |
11-29-2021, 11:30 AM | #2 |
creator of calibre
Posts: 44,279
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You should write a python script for that, not bash, it will be easier. Something like:
Code:
import subprocess users = tuple(filter(None, open('users.txt').read().splitlines())) if users: subprocess.check_call('systemctl stop calibre-server'.split()) for user in users: username, password = user.split() subprocess.check_call(['calibre-server', '--manage-users', '--', 'add', username, password]) subprocess.check_call('systemctl start calibre-server') |
Advert | |
|
11-29-2021, 09:25 PM | #3 | |
Junior Member
Posts: 9
Karma: 10
Join Date: Nov 2021
Device: BOOX Poke 2
|
Quote:
This is exactly what I am up to, python surely makes things much easier In your code i can see you use "-- add" with a space. Is there any documentation on how to edit library restrictions and prompt read-only access? I want to suppress the dialog and input it thru one or a series of commands like what you did there. Thank you in advance |
|
11-30-2021, 07:47 AM | #4 |
creator of calibre
Posts: 44,279
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
No, I'm afraid there is no command for automatically editing restrictions/readonly. You could probably script something up using expect or pexpect. Or open a ticket asking for the feature.
|
11-30-2021, 08:53 AM | #5 | |
Junior Member
Posts: 9
Karma: 10
Join Date: Nov 2021
Device: BOOX Poke 2
|
Quote:
https://bugs.launchpad.net/calibre/+bug/1952764 |
|
Advert | |
|
Tags |
automate, content server, manage users, userdb |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Server chokes on specific library | garysrock | Server | 1 | 10-09-2019 08:43 PM |
add css to specific page | Etshy | Calibre | 1 | 08-09-2017 08:33 AM |
First time reader looking for specific series. Please help! | magicalfatcat | Reading Recommendations | 8 | 05-04-2016 09:29 PM |
Add tag from author and specific column | P.K.Dick | Library Management | 1 | 10-13-2014 03:20 PM |
Bind calibre-server to specific IP/interface | Strupniveral | Related Tools | 3 | 03-21-2012 01:32 PM |