Co to jest format pliku TIMER?
Plik .timer to jednostka czasowa używana przez systemd, system inicjacji i menedżer usług będący podstawą większości dystrybucji Linux. Planuje on moment uruchomienia innej jednostki, zazwyczaj powiązanego pliku .service, i służy jako nowoczesny zamiennik dla cron. Plik jest małym, czystym tekstem UTF-8 w stylu INI, więc zawiera harmonogram, a nie kod programu.
Każdy timer zazwyczaj tworzy parę z usługą o tej samej nazwie bazowej. Plik o nazwie backup.timer wyzwala backup.service, chyba że jego dyrektywa Unit= wskazuje inny cel. Jednostka jest podzielona na trzy sekcje: [Unit] dla opisu i zależności, [Timer] dla harmonogramu oraz [Install] dla włączania poprzez WantedBy=timers.target.
Harmonogramy występują w dwóch formach. Timery czasu rzeczywistego (realtime) używają OnCalendar=, aby uruchamiać się zgodnie z kalendarzem, podobnie jak zadania cron. Timery monotoniczne, takie jak OnBootSec= lub OnUnitActiveSec=, uruchamiają się po określonym czasie od zdarzenia odniesienia, takiego jak rozruch systemu lub ostatnie uruchomienie. Opcje takie jak Persistent=true pozwalają nadrobić pominięte uruchomienie, jeśli maszyna była wyłączona, a RandomizedDelaySec= rozkłada obciążenie na wiele hostów.
Bezpieczeństwo
RYZYKO: LOWA .timer file is plain text with no executable code, so opening it in an editor is safe. The real consideration is trust: a timer can schedule any system command through its paired service, so only install units from sources you trust and review them before enabling with systemctl.
Szczegóły formatu
w pigułce- Construct 2/3 timer behavior data - Some game and animation tools store timer state, but this is not the dominant meaning of the extension.
- Generic application timer/config data - A few niche programs write settings files named with a .timer suffix; these are unrelated to systemd.
Programy otwierające pliki TIMER
.timer file on a workstation before copying it to a Linux host; opens as plain text with optional systemd/INI highlighting. .timer unit as text before deploying it to a Linux server. vim /etc/systemd/system/name.timer; syntax highlighting for systemd units ships with Vim. nano /etc/systemd/system/name.timer; run systemctl daemon-reload afterward to apply changes. systemctl enable --now name.timer, inspect the schedule with systemctl list-timers, and check status with systemctl status name.timer. systemctl edit name.timer and validate its calendar expression using systemd-analyze calendar "OnCalendar-string". .timer file as a plain-text unit; the systemd/INI extensions add highlighting and directive hints. Szczegóły techniczne
specyfikacja| Encoding | UTF-8 plain text |
| Byte order | Not applicable (text) |
| Container | None; INI-style key=value sections |
| Typical size | Under 1 KB |
| Structure | Three sections: [Unit] for description and dependencies, [Timer] for the schedule (OnCalendar, OnBootSec, OnActiveSec, OnUnitActiveSec, OnStartupSec, OnUnitInactiveSec, AccuracySec, RandomizedDelaySec, Persistent, Unit), and [Install] for enablement via WantedBy=timers.target. |
| Integrity | None built in |
| Platforms | Linux |
| Notes | Each .timer file normally pairs with a same-named .service file (foo.timer triggers foo.service unless Unit= overrides). Timers come in realtime (calendar) and monotonic (relative to boot, activation, or last run) forms and serve as a cron alternative managed through systemctl and logged to the systemd journal. |
| File Locations | System units in /usr/lib/systemd/system/ (packaged) and /etc/systemd/system/ (admin overrides); user units in ~/.config/systemd/user/ and /etc/systemd/user/. |
| Line Endings | Unix LF |
| Wydano | 2012 (systemd timer units) |
| Otwarty standard | Tak · bezpłatny (royalty-free) |
| Specyfikacja | man7.org |
Konwersje TIMER
Pytania i odpowiedzi społeczności
pytania użytkownikówBrak pytań - bądź pierwszą osobą, która zapyta o pliki TIMER.
Najczęściej zadawane pytania
Jak otworzyć plik .timer?
nano, vim, VS Code lub Notepad++. Jest to mały plik tekstowy, więc do jego odczytu nie jest wymagane specjalistyczne oprogramowanie.Jaka jest różnica między plikiem .timer a .service?
.service definiuje, co ma zostać uruchomione; plik .timer definiuje, kiedy ma to zostać uruchomione. Timer o nazwie backup.timer aktywuje backup.service, chyba że dyrektywa Unit= stanowi inaczej.Jak włączyć i uruchomić timer?
/etc/systemd/system/, uruchom systemctl daemon-reload, a następnie systemctl enable --now name.timer. Sprawdź go za pomocą systemctl list-timers.Czy timery systemd są lepsze niż cron?
Persistent=true. Cron jest prostszy i bardziej przenośny między systemami Unix. Oba rozwiązania są poprawne; timery są standardem w nowoczesnym systemie Linux.Dlaczego mój timer się nie uruchamia?
systemctl status name.timer, że istnieje pasująca usługa oraz że wyrażenie OnCalendar= jest poprawne. Przetestuj wyrażenie za pomocą systemd-analyze calendar "twój-ciąg".