{"id":501558,"date":"2026-11-03T19:38:35","date_gmt":"2026-11-03T16:38:35","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=501558"},"modified":"2026-11-03T19:38:35","modified_gmt":"2026-11-03T16:38:35","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=501558","title":{"rendered":"\u041c\u0430\u043b\u0430\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442.<\/p>\n<p>\u0415\u0441\u0442\u044c \u043c\u0430\u043b\u0430\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043c\u043e\u0442\u043e\u043a\u0443\u043b\u044c\u0442\u0438\u0432\u0430\u0442\u043e\u0440\u043e\u043c \u0442\u0438\u043f\u0430 &#171;\u041a\u0440\u043e\u0442&#187; \u0441\u0430\u0436\u0430\u0435\u0442\u0435 \u043a\u0430\u0440\u0442\u043e\u0448\u043a\u0443 \u043d\u0430 20 \u0441\u043e\u0442\u043a\u0430\u0445, \u0430 \u0435\u0441\u0442\u044c \u043c\u0430\u043b\u0430\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043b\u0435\u043d\u044c \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0436\u0438\u0440\u043d\u044b\u0439 homeassiant \u0438\/\u0438\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442 \u0432\u0435\u043d\u0434\u043e\u0440\u0430 \u0441 \u0437\u0430\u0432\u044f\u0437\u043a\u043e\u0439 \u043d\u0430 \u043e\u0431\u043b\u0430\u043a\u0430 \u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u0436\u0438\u0442\u044c \u0432 \u0443\u044e\u0442\u043d\u043e\u043c \u043b\u043e\u043a\u0430\u043b\u0445\u043e\u0441\u0442\u0435. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u043f\u0440\u043e \u0432\u0442\u043e\u0440\u0443\u044e. \u0418 \u0434\u0430, \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 &#8212; \u0432\u044b \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0443\u043c\u043d\u044b\u0439 \u0434\u043e\u043c \u0438 \u043d\u0435 \u0442\u044f\u043d\u0443\u043b\u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>\u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0430\u0432\u043d\u043e \u0431\u044b\u043b\u0430 \u043a\u0443\u043f\u043b\u0435\u043d\u0430 \u0440\u043e\u0437\u0435\u0442\u043a\u0430 &#171;\u0423\u043c\u043d\u0430\u044f \u0440\u043e\u0437\u0435\u0442\u043a\u0430 Wi-Fi SmartHome 2300W 10\u0410 IP20 c \u0437\u0430\u0437\u0435\u043c\u043b\u0435\u043d\u0438\u0435\u043c Gauss&#187; \u0432 \u043e\u0437\u043e\u043d\u0435, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0441\u0435\u0439\u0447\u0430\u0441 \u0443\u0436\u0435 \u043d\u0435 \u043f\u0440\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u0438 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043f\u0440\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u043e\u043d\u0430 \u0443 \u0432\u0435\u043d\u0434\u043e\u0440\u0430. \u0412\u0430\u0436\u043d\u043e \u0432 \u043d\u0435\u0439 \u0442\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0442\u0430\u043c Philips WiZ, \u043e\u043d \u0440\u0430\u0441\u043a\u043e\u0432\u044b\u0440\u044f\u043d, \u043c\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435, \u043e\u0442\u0442\u0443\u0434\u0430 \u0438 \u043f\u043e\u0434\u0447\u0435\u0440\u043f\u043d\u0443\u0442\u0430 \u0432\u0430\u0436\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f.<\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0435\u0435 \u0438 \u043f\u0440\u0438\u0431\u043e\u0440\u043e\u0432, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u043d\u0435\u0439, \u043f\u043e \u0437\u0430\u043a\u0430\u0442\u0443 \u0441\u043e\u043b\u043d\u0446\u0430 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0432\u0430\u0448\u0435\u0439 \u043b\u043e\u043a\u0430\u0446\u0438\u0438. \u0418 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 23:00. \u0414\u043b\u044f \u0434\u043e\u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u0430\u0434\u044b \u0434\u043e\u043c\u0430, \u0447\u0442\u043e \u0432\u0435\u0441\u043d\u043e\u0439, \u0447\u0442\u043e \u043e\u0441\u0435\u043d\u044c\u044e.<br \/>\u041f\u0440\u0435\u0440\u0435\u043a\u0432\u0435\u0437\u0438\u0442\u044b &#8212; \u043b\u044e\u0431\u043e\u0439 \u043b\u0438\u043d\u0443\u043a\u0441 \u0445\u043e\u0441\u0442 \u0441 bash, curl, jq, netcat \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442.<br \/>\u0427\u0442\u043e \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c &#8212; \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u0432\u0430\u0448 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 LAN, \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0440\u043e\u0437\u0435\u0442\u043a\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043e\u043d\u0430 \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0438 \u0434\u0430\u0436\u0435 \u0432\u0430\u043b\u044f\u044e\u0449\u0430\u044f\u0441\u044f \u043d\u0430 \u043f\u043e\u043b\u043a\u0435 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u0443\u0433\u043e\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 wifi.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<ol>\n<li>\n<p>\u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u043e \u0432\u0430\u0448\u0435\u043c\u0443 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u0430\u0442, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 <a href=\"http:\/\/api.sunrise-sunset.org\" rel=\"noopener nofollow\">api.sunrise-sunset.org<\/a>, \u044d\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u043b\u044f \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u043d\u0435 \u0438\u0437\u0443\u0447\u0430\u043b, \u0438\u0437\u0432\u0438\u043d\u0438\u0442\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0434\u043e \u0437\u0430\u043a\u0430\u0442\u0430 \u0448\u043b\u0435\u0442 \u0444\u043e\u0440\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0440\u043e\u0437\u0435\u0442\u043a\u0438, \u0447\u0435\u0440\u0435\u0437 nc, \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0435\u0441\u043b\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043d\u0430\u0436\u0430\u043b\u0438 \u043a\u043d\u043e\u043f\u043a\u0443. \u0438\u0437\u043d\u043e\u0441\u0430 \u0440\u043e\u0437\u0435\u0442\u043a\u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0432\u0438\u0434\u043d\u043e, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0437\u0430 3 \u0433\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043a\u0430\u0442\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u0438\u0442\u0430\u043d\u0438\u0435 \u043d\u0430 \u043d\u0435\u0439, \u0442\u0430\u043a \u0436\u0435 \u0447\u0435\u0440\u0435\u0437 nc<\/p>\n<\/li>\n<li>\n<p>\u0432 23:00 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u0442, \u0442\u043a \u0440\u0430\u0441\u0442\u0435\u043d\u0438\u044f\u043c \u0442\u043e\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043f\u0430\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 2-3-4 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0440\u043e\u0437\u0435\u0442\u043e\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443.<\/p>\n<\/li>\n<\/ol>\n<details class=\"spoiler\">\n<summary>\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"bash\">#!\/usr\/bin\/env bash## light.sh## Requires:#   - curl#   - jq#   - GNU date (coreutils)#   - netcat \/ nc## Run:#   .\/light.sh## Print only sunset Unix timestamp:#   .\/light.sh --print-sunset#set -euo pipefail# --------------------------------------------# Config# --------------------------------------------LAT=\"37.619024\"LNG=\"55.751999\"# Use the timezone for both API and 23:00 cutoffTIMEZONE=\"Europe\/Moscow\"# Configurable IP addresses.# Add as many as you need.IP_ADDR=(    \"192.168.1.185\"    # \"192.168.1.186\"    # \"192.168.1.187\")LIGHT_PORT=38899LIGHT_ID=1# --------------------------------------------# Dependency check# --------------------------------------------for cmd in curl jq nc date; do    if ! command -v \"$cmd\" &gt;\/dev\/null 2&gt;&amp;1; then        printf 'Missing dependency: %s\\n' \"$cmd\" &gt;&amp;2        exit 1    fidone# --------------------------------------------# Send UDP command to all configured IPs# --------------------------------------------send_state() {    local state=\"$1\"   # true or false    local json_state    if [[ \"$state\" == \"true\" ]]; then        json_state=\"true\"    else        json_state=\"false\"    fi    for ip in \"${IP_ADDR[@]}\"; do        printf '{\"id\":%s,\"method\":\"setState\",\"params\":{\"state\":%s}}\\n' \\            \"$LIGHT_ID\" \"$json_state\" |            nc -u -w 1 \"$ip\" \"$LIGHT_PORT\" || true    done}# --------------------------------------------# Get sunset as Unix epoch seconds# --------------------------------------------get_sunset_epoch() {    # Explicit local date for the API request.    # This avoids issues if the API interprets \"today\" differently.    local date_str    date_str=$(TZ=\"$TIMEZONE\" date +%Y-%m-%d)    local url    url=\"https:\/\/api.sunrise-sunset.org\/json?lat=${LAT}&amp;lng=${LNG}&amp;date=${date_str}&amp;tzid=${TIMEZONE}&amp;formatted=0\"    local response    response=$(curl -sL --max-time 10 \"$url\") || return 1    if ! jq -e '.status == \"OK\"' &lt;&lt;&lt; \"$response\" &gt;\/dev\/null; then        return 1    fi    local sunset_iso    sunset_iso=$(jq -r '.results.sunset \/\/ \"\"' &lt;&lt;&lt; \"$response\")    if [[ -z \"$sunset_iso\" ]]; then        return 1    fi    # If the API returns only a time like \"18:00:00+03:00\",    # add the local date before conversion.    if [[ ! \"$sunset_iso\" =~ ^[0-9]{4} ]]; then        sunset_iso=\"${date_str} ${sunset_iso}\"    fi    # GNU date supports --date \/ -d    date -d \"$sunset_iso\" +%s}# --------------------------------------------# Optional: print only sunset Unix timestamp# --------------------------------------------if [[ \"${1:-}\" == \"--print-sunset\" ]]; then    printf '%d\\n' \"$(get_sunset_epoch)\"    exit 0fi# --------------------------------------------# Main logic# --------------------------------------------current_epoch=$(date +%s)local_date=$(TZ=\"$TIMEZONE\" date +%Y-%m-%d)cutoff_epoch=$(TZ=\"$TIMEZONE\" date -d \"${local_date} 23:00:00\" +%s)if ! sunset_epoch=$(get_sunset_epoch); then    printf 'ERROR: failed to get sunset from API\\n' &gt;&amp;2    exit 1fiprintf 'current_epoch=%d\\n' \"$current_epoch\"printf 'sunset_epoch=%d\\n' \"$sunset_epoch\"printf 'cutoff_23_00=%d\\n' \"$cutoff_epoch\"# Turn ON only if:#   current time is AFTER sunset#   AND current time is BEFORE 23:00 local time## Otherwise, turn OFF.if (( current_epoch &gt; sunset_epoch &amp;&amp; current_epoch &lt; cutoff_epoch )); then    send_state true    printf 'light_state=on reason=after_sunset_and_before_23:00\\n'else    send_state false    printf 'light_state=off reason=before_sunset_or_after_23:00\\n'fi<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper\"><\/span><\/a><\/div><\/pre>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u0430\u0448\u0443 \u043b\u043e\u043a\u0430\u0446\u0438\u044e (\u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0438\u0437 \u044f\u043d\u0434\u0435\u043a\u0441\u0430), \u0430\u0434\u0440\u0435\u0441\u0430 \u0440\u043e\u0437\u0435\u0442\u043e\u043a, \u0442\u0430\u0439\u043c\u0437\u043e\u043d\u0443, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e \u0432\u043a\u0443\u0441\u0443.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0432 systemd, \u0433\u043e\u0441\u043f\u043e\u0434\u0430\u043c \u0432 openwrt \u0438 \u043f\u0440\u043e\u0447\u0435\u0439 \u0432\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0441\u0440\u0430\u0437\u0443 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0434\u0442\u0438 \u0432 \u043a\u0440\u043e\u043d:<\/p>\n<pre><code class=\"bash\">cat \/usr\/lib\/systemd\/system\/light.service[Unit]Description=Gauss managingAfter=network.target[Service]ExecStart=\/opt\/gauss\/on_off2.shUser=maxRestart=never[Install]WantedBy=multi-user.target<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e  \/opt\/gauss\/on_off2.sh \u043c\u0435\u0441\u0442\u043e, \u043a\u0443\u0434\u0430 \u043c\u044b \u043f\u043e\u043b\u043e\u0436\u0438\u043b\u0438 \u0448\u0435\u043b\u043b\u044c\u043d\u0438\u043a.<\/p>\n<p>\u0418 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0442\u0430\u0439\u043c\u0435\u0440 \/etc\/systemd\/system\/light.timer<\/p>\n<pre><code class=\"bash\">[Unit]Description=Run light.sh every 5 minute[Timer]OnBootSec=1secOnUnitActiveSec=5minUnit=light.service[Install]WantedBy=multi-user.target<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0447\u043d\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432\u0430\u0448 \u0442\u0430\u0439\u043c\u0435\u0440 \u043a\u0430\u0436\u0434\u044b\u0435 5 \u043c\u0438\u043d\u0443\u0442 (\u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e \u0432\u043a\u0443\u0441\u0443).<br \/>\u0414\u0430\u043b\u0435\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e systemctl daemon-reload &amp;&amp; systemctl enable light.service light.timer &amp;&amp; systemctl start light.service light.timer. \u0421\u043a\u0440\u0438\u043f\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0444\u043b\u0443\u0434\u0438\u0442 \u0432 journalctl, \u0434\u0435\u0431\u0430\u0433 \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c.<\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u043b\u0430 \u043e\u0434\u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c, \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043f\u0438\u0441\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u0440\u0443\u043a\u0430\u043c\u0438 \u0431\u044b\u043b \u0443\u0436\u0430\u0441\u0435\u043d \u0438 \u043a \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0435 \u0431\u044b\u043b \u043e\u0434\u043e\u0431\u0440\u0435\u043d.<\/p>\n<p>\u0412\u0441\u0435\u043c \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0443\u0440\u043e\u0436\u0430\u044f<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/7c\/25\/e8\/7c25e8d5438a58a6a0fd661da350cb18.jpg\" width=\"3000\" height=\"4000\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/7c\/25\/e8\/7c25e8d5438a58a6a0fd661da350cb18.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/7c\/25\/e8\/7c25e8d5438a58a6a0fd661da350cb18.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<\/div>\n<\/details>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1103312\/\">https:\/\/habr.com\/ru\/articles\/1103312\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442.\u0415\u0441\u0442\u044c \u043c\u0430\u043b\u0430\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043c\u043e\u0442\u043e\u043a\u0443\u043b\u044c\u0442\u0438\u0432\u0430\u0442\u043e\u0440\u043e\u043c \u0442\u0438\u043f\u0430 &#171;\u041a\u0440\u043e\u0442&#187; \u0441\u0430\u0436\u0430\u0435\u0442\u0435 \u043a\u0430\u0440\u0442\u043e\u0448\u043a\u0443 \u043d\u0430 20 \u0441\u043e\u0442\u043a\u0430\u0445, \u0430 \u0435\u0441\u0442\u044c \u043c\u0430\u043b\u0430\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043b\u0435\u043d\u044c \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0436\u0438\u0440\u043d\u044b\u0439 homeassiant \u0438\/\u0438\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442 \u0432\u0435\u043d\u0434\u043e\u0440\u0430 \u0441 \u0437\u0430\u0432\u044f\u0437\u043a\u043e\u0439 \u043d\u0430 \u043e\u0431\u043b\u0430\u043a\u0430 \u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u0436\u0438\u0442\u044c \u0432 \u0443\u044e\u0442\u043d\u043e\u043c \u043b\u043e\u043a\u0430\u043b\u0445\u043e\u0441\u0442\u0435. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u043f\u0440\u043e \u0432\u0442\u043e\u0440\u0443\u044e. \u0418 \u0434\u0430, \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 &#8212; \u0432\u044b \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0443\u043c\u043d\u044b\u0439 \u0434\u043e\u043c \u0438 \u043d\u0435 \u0442\u044f\u043d\u0443\u043b\u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0430 \u0437\u0430\u0440\u0430\u043d\u0435\u0435.\u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u0430\u0432\u043d\u043e \u0431\u044b\u043b\u0430 \u043a\u0443\u043f\u043b\u0435\u043d\u0430 \u0440\u043e\u0437\u0435\u0442\u043a\u0430 &#171;\u0423\u043c\u043d\u0430\u044f \u0440\u043e\u0437\u0435\u0442\u043a\u0430 Wi-Fi SmartHome 2300W 10\u0410 IP20 c \u0437\u0430\u0437\u0435\u043c\u043b\u0435\u043d\u0438\u0435\u043c Gauss&#187; \u0432 \u043e\u0437\u043e\u043d\u0435, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u0441\u0435\u0439\u0447\u0430\u0441 \u0443\u0436\u0435 \u043d\u0435 \u043f\u0440\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u0438 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043f\u0440\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u043e\u043d\u0430 \u0443 \u0432\u0435\u043d\u0434\u043e\u0440\u0430. \u0412\u0430\u0436\u043d\u043e \u0432 \u043d\u0435\u0439 \u0442\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0442\u0430\u043c Philips WiZ, \u043e\u043d \u0440\u0430\u0441\u043a\u043e\u0432\u044b\u0440\u044f\u043d, \u043c\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435, \u043e\u0442\u0442\u0443\u0434\u0430 \u0438 \u043f\u043e\u0434\u0447\u0435\u0440\u043f\u043d\u0443\u0442\u0430 \u0432\u0430\u0436\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f.\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0435\u0435 \u0438 \u043f\u0440\u0438\u0431\u043e\u0440\u043e\u0432, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u043d\u0435\u0439, \u043f\u043e \u0437\u0430\u043a\u0430\u0442\u0443 \u0441\u043e\u043b\u043d\u0446\u0430 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0432\u0430\u0448\u0435\u0439 \u043b\u043e\u043a\u0430\u0446\u0438\u0438. \u0418 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 23:00. \u0414\u043b\u044f \u0434\u043e\u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u0430\u0434\u044b \u0434\u043e\u043c\u0430, \u0447\u0442\u043e \u0432\u0435\u0441\u043d\u043e\u0439, \u0447\u0442\u043e \u043e\u0441\u0435\u043d\u044c\u044e.\u041f\u0440\u0435\u0440\u0435\u043a\u0432\u0435\u0437\u0438\u0442\u044b &#8212; \u043b\u044e\u0431\u043e\u0439 \u043b\u0438\u043d\u0443\u043a\u0441 \u0445\u043e\u0441\u0442 \u0441 bash, curl, jq, netcat \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442.\u0427\u0442\u043e \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c &#8212; \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 \u0432\u0430\u0448 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 LAN, \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0440\u043e\u0437\u0435\u0442\u043a\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043e\u043d\u0430 \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0438 \u0434\u0430\u0436\u0435 \u0432\u0430\u043b\u044f\u044e\u0449\u0430\u044f\u0441\u044f \u043d\u0430 \u043f\u043e\u043b\u043a\u0435 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u0443\u0433\u043e\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 wifi.\u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u043a\u0440\u0438\u043f\u0442:\u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u043e \u0432\u0430\u0448\u0435\u043c\u0443 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u0430\u0442, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 api.sunrise-sunset.org, \u044d\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u043b\u044f \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u043d\u0435 \u0438\u0437\u0443\u0447\u0430\u043b, \u0438\u0437\u0432\u0438\u043d\u0438\u0442\u0435.\u0434\u043e \u0437\u0430\u043a\u0430\u0442\u0430 \u0448\u043b\u0435\u0442 \u0444\u043e\u0440\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0440\u043e\u0437\u0435\u0442\u043a\u0438, \u0447\u0435\u0440\u0435\u0437 nc, \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0435\u0441\u043b\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043d\u0430\u0436\u0430\u043b\u0438 \u043a\u043d\u043e\u043f\u043a\u0443. \u0438\u0437\u043d\u043e\u0441\u0430 \u0440\u043e\u0437\u0435\u0442\u043a\u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0432\u0438\u0434\u043d\u043e, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0437\u0430 3 \u0433\u043e\u0434\u0430.\u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043a\u0430\u0442\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u0438\u0442\u0430\u043d\u0438\u0435 \u043d\u0430 \u043d\u0435\u0439, \u0442\u0430\u043a \u0436\u0435 \u0447\u0435\u0440\u0435\u0437 nc\u0432 23:00 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u0442, \u0442\u043a \u0440\u0430\u0441\u0442\u0435\u043d\u0438\u044f\u043c \u0442\u043e\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043f\u0430\u0442\u044c\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 2-3-4 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0440\u043e\u0437\u0435\u0442\u043e\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0443.\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442#!\/usr\/bin\/env bash## light.sh## Requires:#   &#8212; curl#   &#8212; jq#   &#8212; GNU date (coreutils)#   &#8212; netcat \/ nc## Run:#   .\/light.sh## Print only sunset Unix timestamp:#   .\/light.sh &#8212;print-sunset#set -euo pipefail# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;# Config# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;LAT=&#187;37.619024&#8243;LNG=&#187;55.751999&#8243;# Use the timezone for both API and 23:00 cutoffTIMEZONE=&#187;Europe\/Moscow&#187;# Configurable IP addresses.# Add as many as you need.IP_ADDR=(    &#171;192.168.1.185&#187;    # &#171;192.168.1.186&#187;    # &#171;192.168.1.187&#187;)LIGHT_PORT=38899LIGHT_ID=1# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;# Dependency check# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;for cmd in curl jq nc date; do    if ! command -v &#171;$cmd&#187; &gt;\/dev\/null 2&gt;&amp;1; then        printf &#8216;Missing dependency: %s\\n&#8217; &#171;$cmd&#187; &gt;&amp;2        exit 1    fidone# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;# Send UDP command to all configured IPs# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;send_state() {    local state=&#187;$1&#8243;   # true or false    local json_state    if [[ &#171;$state&#187; == &#171;true&#187; ]]; then        json_state=&#187;true&#187;    else        json_state=&#187;false&#187;    fi    for ip in &#171;${IP_ADDR[@]}&#187;; do        printf &#8216;{&#171;id&#187;:%s,&#187;method&#187;:&#187;setState&#187;,&#187;params&#187;:{&#171;state&#187;:%s}}\\n&#8217; \\            &#171;$LIGHT_ID&#187; &#171;$json_state&#187; |            nc -u -w 1 &#171;$ip&#187; &#171;$LIGHT_PORT&#187; || true    done}# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;# Get sunset as Unix epoch seconds# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;get_sunset_epoch() {    # Explicit local date for the API request.    # This avoids issues if the API interprets &#171;today&#187; differently.    local date_str    date_str=$(TZ=&#187;$TIMEZONE&#187; date +%Y-%m-%d)    local url    url=&#187;https:\/\/api.sunrise-sunset.org\/json?lat=${LAT}&amp;lng=${LNG}&amp;date=${date_str}&amp;tzid=${TIMEZONE}&amp;formatted=0&#8243;    local response    response=$(curl -sL &#8212;max-time 10 &#171;$url&#187;) || return 1    if ! jq -e &#8216;.status == &#171;OK&#187;&#8216; &lt;&lt;&lt; &#171;$response&#187; &gt;\/dev\/null; then        return 1    fi    local sunset_iso    sunset_iso=$(jq -r &#8216;.results.sunset \/\/ &#171;&#187;&#8216; &lt;&lt;&lt; &#171;$response&#187;)    if [[ -z &#171;$sunset_iso&#187; ]]; then        return 1    fi    # If the API returns only a time like &#171;18:00:00+03:00&#187;,    # add the local date before conversion.    if [[ ! &#171;$sunset_iso&#187; =~ ^[0-9]{4} ]]; then        sunset_iso=&#187;${date_str} ${sunset_iso}&#187;    fi    # GNU date supports &#8212;date \/ -d    date -d &#171;$sunset_iso&#187; +%s}# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;# Optional: print only sunset Unix timestamp# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;if [[ &#171;${1:-}&#187; == &#171;&#8212;print-sunset&#187; ]]; then    printf &#8216;%d\\n&#8217; &#171;$(get_sunset_epoch)&#187;    exit 0fi# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;# Main logic# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;current_epoch=$(date +%s)local_date=$(TZ=&#187;$TIMEZONE&#187; date +%Y-%m-%d)cutoff_epoch=$(TZ=&#187;$TIMEZONE&#187; date -d &#171;${local_date} 23:00:00&#187; +%s)if ! sunset_epoch=$(get_sunset_epoch); then    printf &#8216;ERROR: failed to get sunset from API\\n&#8217; &gt;&amp;2    exit 1fiprintf &#8216;current_epoch=%d\\n&#8217; &#171;$current_epoch&#187;printf &#8216;sunset_epoch=%d\\n&#8217; &#171;$sunset_epoch&#187;printf &#8216;cutoff_23_00=%d\\n&#8217; &#171;$cutoff_epoch&#187;# Turn ON only if:#   current time is AFTER sunset#   AND current time is BEFORE 23:00 local time## Otherwise, turn OFF.if (( current_epoch &gt; sunset_epoch &amp;&amp; current_epoch &lt; cutoff_epoch )); then    send_state true    printf &#8216;light_state=on reason=after_sunset_and_before_23:00\\n&#8217;else    send_state false    printf &#8216;light_state=off reason=before_sunset_or_after_23:00\\n&#8217;fi\u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u0430\u0448\u0443 \u043b\u043e\u043a\u0430\u0446\u0438\u044e (\u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0438\u0437 \u044f\u043d\u0434\u0435\u043a\u0441\u0430), \u0430\u0434\u0440\u0435\u0441\u0430 \u0440\u043e\u0437\u0435\u0442\u043e\u043a, \u0442\u0430\u0439\u043c\u0437\u043e\u043d\u0443, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e \u0432\u043a\u0443\u0441\u0443.\u0414\u0430\u043b\u0435\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0432 systemd, \u0433\u043e\u0441\u043f\u043e\u0434\u0430\u043c \u0432 openwrt \u0438 \u043f\u0440\u043e\u0447\u0435\u0439 \u0432\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0441\u0440\u0430\u0437\u0443 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0434\u0442\u0438 \u0432 \u043a\u0440\u043e\u043d:cat \/usr\/lib\/systemd\/system\/light.service[Unit]Description=Gauss managingAfter=network.target[Service]ExecStart=\/opt\/gauss\/on_off2.shUser=maxRestart=never[Install]WantedBy=multi-user.target\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e  \/opt\/gauss\/on_off2.sh \u043c\u0435\u0441\u0442\u043e, \u043a\u0443\u0434\u0430 \u043c\u044b \u043f\u043e\u043b\u043e\u0436\u0438\u043b\u0438 \u0448\u0435\u043b\u043b\u044c\u043d\u0438\u043a.\u0418 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0442\u0430\u0439\u043c\u0435\u0440 \/etc\/systemd\/system\/light.timer[Unit]Description=Run light.sh every 5 minute[Timer]OnBootSec=1secOnUnitActiveSec=5minUnit=light.service[Install]WantedBy=multi-user.target\u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0447\u043d\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0432\u0430\u0448 \u0442\u0430\u0439\u043c\u0435\u0440 \u043a\u0430\u0436\u0434\u044b\u0435 5 \u043c\u0438\u043d\u0443\u0442 (\u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e \u0432\u043a\u0443\u0441\u0443).\u0414\u0430\u043b\u0435\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e systemctl daemon-reload &amp;&amp; systemctl enable light.service light.timer &amp;&amp; systemctl start light.service light.timer. \u0421\u043a\u0440\u0438\u043f\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0444\u043b\u0443\u0434\u0438\u0442 \u0432 journalctl, \u0434\u0435\u0431\u0430\u0433 \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c.\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u043b\u0430 \u043e\u0434\u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c, \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u043f\u0438\u0441\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u0440\u0443\u043a\u0430\u043c\u0438 \u0431\u044b\u043b \u0443\u0436\u0430\u0441\u0435\u043d \u0438 \u043a \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0435 \u0431\u044b\u043b \u043e\u0434\u043e\u0431\u0440\u0435\u043d.\u0412\u0441\u0435\u043c \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u0443\u0440\u043e\u0436\u0430\u044f\u0421\u043a\u0440\u044b\u0442\u044b\u0439 \u0442\u0435\u043a\u0441\u0442\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 https:\/\/habr.com\/ru\/articles\/1103312\/<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-501558","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/501558","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=501558"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/501558\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=501558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=501558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=501558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}