Normalize unicode file names (converts UTF-8 NFD to NFC).
Required by macOS clients through AFP/NFS/SMB.
Tested on Synology DSM 6.2 with built-in Python 2.7.12.
# Apple Silicon laptops with firmware > 13.0 have a native charge threshold that does not required any userspace daemon running. | |
# This native limit works even when the laptop is sleeping or powered off therefore it is preferable to the userspace daemon. | |
# Nonetheless, it only works with fixed thresholds (80% as upper limit and 70% as lower limit). | |
# CHWA key is the one used to enable/disable the native limit. 01 = 80% limit, 00 = no limit | |
## | |
typeset -g smc_command="/usr/local/bin/smc" | |
typeset -g smc_charge_limit_key="CHWA" | |
typeset -g smc_charge_limit_status_on="01" | |
typeset -g smc_charge_limit_status_off="00" |
Timers provided by systemd can be used as cronjob replacements. More at man systemd.timer
.
Suppose we want to periodically trigger cleanup tasks for a baz
utility. We 'll create a baz-cleanup.service
which will
be triggered by a baz-cleanup.timer
.
Create a minimal service at /etc/systemd/system/baz-cleanup.service
:
This is an example of a socket-activated per-connection service (which is usually referred to as inetd-like service). A thorough explanation can be found at http://0pointer.de/blog/projects/inetd.html.
The key point here is to specify Accept=yes
, which will make the socket accept connections (behaving like inetd) and pass
only the resulting connection socket to the service handler.
Services declared as oneshot
are expected to take some action and exit immediatelly (thus, they are not really services,
no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.
Let's create a example foo
service that when started creates a file, and when stopped it deletes it.
Create executable file /opt/foo/setup-foo.sh
:
Create a template service file at /etc/systemd/system/[email protected]
. The template parameter will correspond to the name
of target host:
[Unit]
Description=Setup a secure tunnel to %I
After=network.target
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Haochi Chen <http://ihaochi.com> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |