syncthing-service
Example:
# Install Syncthing for Linux/amd64 and enable Syncthing service for user 'admin'. - syncthing-service: users: - admin
Description
Download and install the Syncthing binary for the specified architecture/platform, then create a systemd service unit and enable the Syncthing service for one or several users (which will be created if they don't exist yet).
Variables
Name | Type | Default | Description |
---|---|---|---|
|
list | -- | List of users to enable/start the Syncthing service for on system boot. Required |
|
boolean | False | Whether to add a cron job to check for upgrades and upgrade/restart syncthing if there is one (default: false). |
|
string | amd64 | The architecture of the host system. |
|
string | linux | The platform of the host system. |
|
string | 1.2.1 | The version of the product. |
Examples
Example 1
Install Syncthing for Linux/amd64 and enable Syncthing service for user 'admin'.
Code
- syncthing-service: users: - admin
Code
doc: short_help: Download/install syncthing and enable Syncthing service for user on system startup. help: | Download and install the Syncthing binary for the specified architecture/platform, then create a systemd service unit and enable the Syncthing service for one or several users (which will be created if they don't exist yet). examples: - title: Install Syncthing for Linux/amd64 and enable Syncthing service for user 'admin'. vars: users: - admin args: _import: - syncthing-installed users: doc: short_help: List of users to enable/start the Syncthing service for on system boot. type: list schema: type: string empty: true cli: param_decls: - --user - -u add_upgrade_cronjob: doc: short_help: 'Whether to add a cron job to check for upgrades and upgrade/restart syncthing if there is one (default: false).' type: boolean default: false frecklets: - syncthing-installed: version: '{{:: version ::}}' arch: '{{:: arch ::}}' platform: '{{:: platform ::}}' owner: root group: root - systemd-service-unit: name: syncthing is_template_unit: true unit_description: Open Source Continuous File Synchronization for %I unit_after: - network.target service_user: '%i' service_exec_start: /usr/local/bin/syncthing -no-browser -no-restart -logflags=0 service_restart: on-failure service_success_exit_status: - 3 - 4 service_restart_force_exit_status: - 3 - 4 service_protect_system: full service_private_tmp: true service_system_call_architectures: - native service_memory_deny_write_execute: true service_no_new_privileges: true install_wanted_by: - multi-user.target - users-exist: names: '{{:: users ::}}' - systemd-template-units-configured: name: syncthing instance_names: '{{:: users ::}}' enabled: true started: true - syncthing-upgrade-script: frecklet::skip: '{{:: add_upgrade_cronjob | negate ::}}'
frecklecute syncthing-service --help Usage: frecklecute syncthing-service [OPTIONS] Download and install the Syncthing binary for the specified architecture/platform, then create a systemd service unit and enable the Syncthing service for one or several users (which will be created if they don't exist yet). Options: -u, --user USERS List of users to enable/start the Syncthing service for on system boot. [required] --add-upgrade-cronjob / --no-add-upgrade-cronjob Whether to add a cron job to check for upgrades and upgrade/restart syncthing if there is one (default: false). --arch ARCH The architecture of the host system. --platform PLATFORM The platform of the host system. --version VERSION The version of the product. --help Show this message and exit.
# -*- coding: utf-8 -*- # # module path: pycklets.syncthing_service.SyncthingService # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class SyncthingService(AutoPycklet): """Download and install the Syncthing binary for the specified architecture/platform, then create a systemd service unit and enable the Syncthing service for one or several users (which will be created if they don't exist yet). Args: add_upgrade_cronjob: Whether to add a cron job to check for upgrades and upgrade/restart syncthing if there is one (default: false). arch: The architecture of the host system. platform: The platform of the host system. users: List of users to enable/start the Syncthing service for on system boot. version: The version of the product. """ FRECKLET_ID = "syncthing-service" add_upgrade_cronjob: bool = None arch: str = None platform: str = None users: List = None version: str = None def __post_init__(self): super(SyncthingService, self).__init__(var_names=["add_upgrade_cronjob", "arch", "platform", "users", "version"]) frecklet_class = SyncthingService
# -*- coding: utf-8 -*- # # module path: pycklets.syncthing_service.SyncthingService # from pyckles import AutoPycklet class SyncthingService(AutoPycklet): """Download and install the Syncthing binary for the specified architecture/platform, then create a systemd service unit and enable the Syncthing service for one or several users (which will be created if they don't exist yet). Args: add_upgrade_cronjob: Whether to add a cron job to check for upgrades and upgrade/restart syncthing if there is one (default: false). arch: The architecture of the host system. platform: The platform of the host system. users: List of users to enable/start the Syncthing service for on system boot. version: The version of the product. """ FRECKLET_ID = "syncthing-service" def __init__(self, add_upgrade_cronjob=None, arch="amd64", platform="linux", users=None, version="1.2.1"): super(SyncthingService, self).__init__(var_names=["add_upgrade_cronjob", "arch", "platform", "users", "version"]) self._add_upgrade_cronjob = add_upgrade_cronjob self._arch = arch self._platform = platform self._users = users self._version = version @property def add_upgrade_cronjob(self): return self._add_upgrade_cronjob @add_upgrade_cronjob.setter def add_upgrade_cronjob(self, add_upgrade_cronjob): self._add_upgrade_cronjob = add_upgrade_cronjob @property def arch(self): return self._arch @arch.setter def arch(self, arch): self._arch = arch @property def platform(self): return self._platform @platform.setter def platform(self, platform): self._platform = platform @property def users(self): return self._users @users.setter def users(self, users): self._users = users @property def version(self): return self._version @version.setter def version(self, version): self._version = version frecklet_class = SyncthingService