Wat is het TIMER-bestandsformaat?
Een .timer-bestand is een timer-unit die wordt gebruikt door systemd, het init-systeem en de servicemanager achter de meeste Linux-distributies. Het plant wanneer een andere unit wordt uitgevoerd, meestal een bijbehorend .service-bestand, en fungeert als een moderne vervanging voor cron. Het bestand is kleine, platte UTF-8-tekst in INI-stijl, dus het bevat een schema in plaats van programmacode.
Elke timer is normaal gesproken gekoppeld aan een service met dezelfde basisnaam. Een bestand genaamd backup.timer triggert backup.service, tenzij de Unit=-richtlijn een ander doel noemt. De unit is georganiseerd in drie secties: [Unit] voor de beschrijving en afhankelijkheden, [Timer] voor het schema, en [Install] voor activering via WantedBy=timers.target.
Schema's zijn er in twee vormen. Realtime-timers gebruiken OnCalendar= om af te gaan op kalendergebeurtenissen, net zoals een cron-job dat doet. Monotone timers zoals OnBootSec= of OnUnitActiveSec= gaan af na een ingestelde tijdsduur na een referentiegebeurtenis zoals het opstarten of de laatste uitvoering. Opties zoals Persistent=true halen een gemiste uitvoering in nadat de machine uit stond, en RandomizedDelaySec= spreidt de belasting over veel hosts.
Beveiliging & veiligheid
RISICO: 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.
Formaatdetails
in een notendop- 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.
Programma's die TIMER-bestanden openen
.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. Technische details
diepe specificaties| 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 |
| Uitgebracht | 2012 (systemd timer units) |
| Open standaard | Ja · royaltyvrij |
| Specificatie | man7.org |
TIMER conversies
Community V&A
gevraagd door gebruikersNog geen vragen - wees de eerste om iets te vragen over TIMER-bestanden.
Veelgestelde vragen
Hoe open ik een .timer-bestand?
nano, vim, VS Code of Notepad++. Het is een klein tekstbestand, dus er is geen speciale software vereist om het te lezen.Wat is het verschil tussen een .timer- en een .service-bestand?
.service-bestand definieert *wat* er moet worden uitgevoerd; een .timer-bestand definieert *wanneer* het moet worden uitgevoerd. Een timer genaamd backup.timer activeert backup.service, tenzij de Unit=-richtlijn anders aangeeft.Hoe schakel ik een timer in en start ik deze?
/etc/systemd/system/, voer systemctl daemon-reload uit, en daarna systemctl enable --now name.timer. Controleer het met systemctl list-timers.Zijn systemd-timers beter dan cron?
Persistent=true. Cron is eenvoudiger en meer overdraagbaar tussen Unix-systemen. Beiden zijn valide; timers zijn gebruikelijk op modern Linux.Waarom gaat mijn timer niet af?
systemctl status name.timer, dat er een bijbehorende service bestaat en dat de OnCalendar=-expressie geldig is. Test de expressie met systemd-analyze calendar "uw-string".