View Single Post
Old 11-29-2021, 09:25 PM   #3
siclib
Junior Member
siclib began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Nov 2021
Device: BOOX Poke 2
Thumbs up

Quote:
Originally Posted by kovidgoyal View Post
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')

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
siclib is offline   Reply With Quote