duck.cli.commands.serviceยถ

Module containing commands for creating and managing Duck services using systemd (compatible with linux-based systems only).

Module Contentsยถ

Classesยถ

ServiceCommand

Dataยถ

SERVICE_CONTENT

APIยถ

duck.cli.commands.service.SERVICE_CONTENT = <Multiline-String>ยถ
class duck.cli.commands.service.ServiceCommand[source]ยถ
classmethod autorun(kill: bool = False, enable: bool = False, disable: bool = False, settings: str = None, show_status: bool = True)[source]ยถ

This automatically creates and runs the Duck service at latest changes, you do not need to reload systemd, everything will be done for you.

The status of the service will be printed after if the other steps completed successfully.

Parameters:
  • kill โ€“ Whether to kill a running Duck service (if present) before running this new latest service.

  • enable โ€“ Enables the new service to be started on boot.

  • disable โ€“ Disables the new service not to be started on boot.

  • settings โ€“ Customizable comma-separated Duck settings you want to change at runtime without depending on settings.py. Example: key=value, key2=value2

  • status โ€“ Whether to show status of the service if other steps completed.

classmethod check_service()[source]ยถ

Method to check the status of the systemd service and display detailed information.

classmethod create_service(settings: str = None)[source]ยถ

Function to create the systemd service for Duck.

Parameters:

settings โ€“ Customizable comma-separated Duck settings you want to change at runtime without depending on settings.py. Example: key=value, key2=value2

Notes:

  • The settings argument can only be useful for string value type settings.

Example Usage:

duck service create --settings "systemd_exec_command=duck runserver -p 5000, systemd_restart=always"
classmethod disable_service()[source]ยถ

Method to disable the systemd service from starting on boot

classmethod enable_service()[source]ยถ

Function to enable the systemd service to start on boot

classmethod register_subcommands(main_command: click.Command)[source]ยถ

Register the subcommands for the duck service command.

classmethod reload_systemd()[source]ยถ

Method to reload systemd to apply the new service

classmethod start_service()[source]ยถ

Method to start the systemd service

classmethod stop_service()[source]ยถ

Method to stop the systemd service