Che cos'è il formato di file TIMER?
Un file .timer è un'unità timer utilizzata da systemd, il sistema di inizializzazione e gestore dei servizi alla base della maggior parte delle distribuzioni Linux. Pianifica l'esecuzione di un'altra unità, solitamente un file .service corrispondente, e funge da sostituto moderno di cron. Il file è un piccolo testo semplice in UTF-8 in stile INI, pertanto contiene una pianificazione piuttosto che codice di programma.
Ogni timer è normalmente accoppiato a un servizio con lo stesso nome di base. Un file chiamato backup.timer attiva backup.service a meno che la sua direttiva Unit= non indichi un target diverso. L'unità è organizzata in tre sezioni: [Unit] per la descrizione e le dipendenze, [Timer] per la pianificazione e [Install] per l'abilitazione tramite WantedBy=timers.target.
Le pianificazioni si presentano in due forme. I timer in tempo reale (realtime) usano OnCalendar= per attivarsi in base a eventi del calendario, proprio come un job di cron. I timer monotonici come OnBootSec= o OnUnitActiveSec= si attivano dopo un intervallo prestabilito da un evento di riferimento come l'avvio o l'ultima esecuzione. Opzioni come Persistent=true recuperano un'esecuzione saltata dopo che la macchina è stata spenta, e RandomizedDelaySec= distribuisce il carico su più host.
Sicurezza e incolumità
RISCHIO: 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.
Dettagli del formato
in sintesi- 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.
Programmi che aprono file 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. Dettagli tecnici
specifiche approfondite| 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 |
| Rilasciato | 2012 (systemd timer units) |
| Standard aperto | Sì · royalty-free |
| Specifica | man7.org |
Conversioni TIMER
Domande e risposte della community
chiesto dagli utentiAncora nessuna domanda - sii il primo a chiedere informazioni sui file TIMER.
Domande frequenti
Come apro un file .timer?
nano, vim, VS Code o Notepad++. È un piccolo file di testo semplice, quindi non è necessario alcun software speciale per leggerlo.Qual è la differenza tra un file .timer e un file .service?
.service definisce «cosa» eseguire; un file .timer definisce «quando» eseguirlo. Un timer chiamato backup.timer attiva backup.service a meno che la sua direttiva Unit= non indichi diversamente.Come faccio ad abilitare e avviare un timer?
/etc/systemd/system/, esegui systemctl daemon-reload, quindi systemctl enable --now name.timer. Controllalo con systemctl list-timers.I timer di systemd sono migliori di cron?
Persistent=true. Cron è più semplice e portabile tra i sistemi Unix. Entrambi sono validi; i timer sono lo standard sui moderni sistemi Linux.Perché il mio timer non si attiva?
systemctl status name.timer, che esista un servizio corrispondente e che l'espressione OnCalendar= sia valida. Testa l'espressione con systemd-analyze calendar "tua-stringa".