Checking if Custom systemd Timer Loads and Works on Debian 10

Abstract: Resolve issues where custom systemd timers fail to load or execute on Debian 10 by verifying unit configuration and analyzing service logs.

Created: 2026-08-17 by
To verify that a custom systemd timer loads and executes correctly on Debian 10, you must first ensure the associated service unit is valid and enabled. Use systemctl list-timers to check if the timer appears in the active schedule, and run systemctl status <timer-name> for detailed runtime logs. If the timer does not trigger, inspect the journal with journalctl -u <service-name> to identify permission errors or missing dependencies that prevent execution.

Creating the Service and Timer Units

Before troubleshooting, it is essential to have properly configured unit files. A systemd timer relies on a companion service file to define what action to perform. Create a service file, such as <name>.service, in /etc/systemd/system/. This file should specify the executable script or command under the [Service] section. For example:
[Unit]
Description=My Custom Task

[Service]
Type=oneshot
ExecStart=/usr/local/bin/my-script.sh
Next, create the corresponding timer file, <name>.timer, in the same directory. The timer defines when the service runs. You can use OnCalendar= for specific times or OnUnitActiveSec= for relative intervals. Ensure the WantedBy=timers.target line is present in the [Install] section to enable the timer.
[Unit]
Description=Run My Custom Task Daily

[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true

[Install]
WantedBy=timers.target
After creating these files, reload the systemd daemon using sudo systemctl daemon-reload. Then, enable both the service and the timer:
sudo systemctl enable my-script.service
sudo systemctl enable my-script.timer
Enabling the timer starts it immediately. You can confirm it is running by checking its status. If you need to manage dependencies between services, consider reviewing how to restart systemd service dependencies effectively.

Verifying Timer Activation

The most direct way to check if your timer is loaded is to list all active timers. Run the following command:
systemctl list-timers --all
This output shows the next activation time, last activation time, and unit name for each timer. Look for your custom timer in this list. If it is missing, the timer was not enabled correctly, or there is a syntax error in the unit file. The --all flag ensures you see disabled timers as well, which helps diagnose configuration issues. You can also get detailed information about a specific timer:
systemctl status my-script.timer
This command displays whether the timer is active (running) or inactive (dead). It also shows recent log entries related to the timer unit. If the timer is active but not triggering, proceed to check the service logs.

Checking Service Execution Logs

Even if the timer is active, the service might fail to execute due to script errors or permission issues. Use the journal to view logs for the service:
journalctl -u my-script.service -f
The -f flag follows the log in real-time. Trigger the timer manually by running:
systemctl start my-script.service
Then observe the journal output. If the script fails, the error messages will appear here. Common issues include incorrect paths in ExecStart, lack of execute permissions on the script, or environment variables not being set. For more complex setups involving variables, refer to guides on expanding the use of variables in systemd service files. If the service depends on other system resources, ensure those dependencies are met. Failure to start due to unmet dependencies is a frequent cause of silent failures.

Testing Manual Triggers

To isolate timing issues, disable the timer temporarily and run the service manually:
sudo systemctl stop my-script.timer
sudo systemctl start my-script.service
Check the exit status with echo $?. A zero indicates success. If the script runs manually but not via the timer, the issue may be related to the environment context. Systemd timers run in a limited environment compared to user shells. Ensure absolute paths are used for all commands and scripts. Also, verify that the timer is not masked. A masked unit cannot be started even if enabled. Check with:
systemctl is-enabled my-script.timer
It should return "enabled". If it returns "masked", unmask it with sudo systemctl unmask my-script.timer.

Common Pitfalls and Fixes

Several common mistakes prevent timers from working. First, ensure the timer file has correct syntax. A single typo in OnCalendar can disable the timer silently. Second, check file permissions. The service file should be readable by root, and the script should be executable. Third, avoid using ~ or $HOME in unit files unless explicitly expanded, as systemd does not interpret shell expansions by default. If you suspect conflicts with other system processes, review related system tasks. For instance, if your timer interacts with mounted drives, ensure shares are automatically mounted before the service runs. Refer to documentation on automatically mounting shares in Linux to resolve such dependency issues. Finally, remember that systemd timers are precise. If you miss a scheduled run due to the system being off, the Persistent=true option ensures the missed run occurs at the next boot. Always test changes in a staging environment before applying them to production systems.

Frequently Asked Questions

Why does my timer show as inactive in systemctl list-timers?

An inactive timer usually means it is not enabled or failed to start during boot. Verify that you ran systemctl enable <timer-name> and that the unit file contains no syntax errors. Check systemctl status <timer-name> for specific failure reasons.

How can I debug why my service script fails only when run by a timer?

Timers run in a restricted environment without user shell variables. Use absolute paths for all executables and scripts in the ExecStart directive. Check journalctl -u <service-name> for error messages that indicate missing files or permissions.

What does Persistent=true do in a timer unit?

The Persistent=true setting ensures that if the system is powered off during a scheduled run, the timer will trigger the service immediately upon the next boot. This guarantees that periodic tasks are not skipped due to downtime.

Can I use relative time intervals like OnUnitActiveSec=5min?

Yes, you can use relative intervals such as OnUnitActiveSec=5min or OnBootSec=1min. These intervals reset after each successful activation or boot, respectively. They are useful for recurring tasks that do not need to align with clock time.

How do I force a timer to run immediately for testing?

You can manually trigger the associated service by running systemctl start <service-name>. This bypasses the timer schedule and allows you to test the service logic directly. Remember to restart the timer afterward if you want normal scheduling to resume.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More