quota_notifier.shell

Tools for running shell commands and fetching user data from the underlying system shell.

Module Contents

class quota_notifier.shell.ShellCmd(cmd: str, timeout: int | None = 30)[source]

Execute commands using the underlying shell

Outputs to STDOUT and STDERR are exposed via the out and err attributes respectively.

prohibited_characters = '!#$%&\\*+:;<>?@[]^`{|}~'
__init__(cmd: str, timeout: int | None = 30) None[source]

Execute the given command in the underlying shell

Parameters:
  • cmd – The command to run

  • timeout – Timeout if command does not exit in given number of seconds

Raises:
  • ValueError – When the cmd argument is empty

  • TimeoutExpired – If the command times out

class quota_notifier.shell.User(username: str)[source]

Fetch identifying information for a given username

__init__(username: str) None[source]

Fetch identifying information for the given username

Parameters:

username – The name of the user

classmethod iter_all_users() Iterator[User][source]

Iterable over user objects for all users on the system

property username: str

Return the instance username

property group: str

Fetch and return the users group name

property uid: int

Fetch and return the users user id

property gid: int

Fetch and return the users group id