|
|
#1 |
|
Junior Member
![]() Posts: 9
Karma: 10
Join Date: Nov 2021
Device: BOOX Poke 2
|
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 |
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,720
Karma: 28549306
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 | |
|
|
|
|
#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
|
|
|
|
|
|
|
#4 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,720
Karma: 28549306
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.
|
|
|
|
|
|
#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 09:43 PM |
| add css to specific page | Etshy | Calibre | 1 | 08-09-2017 09:33 AM |
| First time reader looking for specific series. Please help! | magicalfatcat | Reading Recommendations | 8 | 05-04-2016 10:29 PM |
| Add tag from author and specific column | P.K.Dick | Library Management | 1 | 10-13-2014 04:20 PM |
| Bind calibre-server to specific IP/interface | Strupniveral | Related Tools | 3 | 03-21-2012 02:32 PM |