HamClock as a Linux service

HamClock is a brilliant piece of software, bringing many useful information on a screen. It can be run on Linux, also with web interface accessible over the net. Per default it is not however available as a service, meaning it needs to be manually started after any power cycle of its Linux host. This short article shows how to make it a service, start it automatically during system startup and how to restart it periodically.

Read more: HamClock as a Linux service

I assume you have HamClock already installed on your system and now you just want to make it start automatically, so you do not have to logon and start it manually after every restart of the host server. If this assumption is not correct please visit HamClock home page – the installation procedure is well described there.

Enabling auto-start is simple:

  • Create service file
  • Enable hamclock service and start it
  • (optionally) Setup restart of the service periodically using crontab

The below procedure should be quite universal and work on most Linux distros.

Create service file

Your Linux user need to be able to use sudo to issue the following commands (using terminal or system console):

sudo touch /etc/systemd/system/hamclock.service

Edit the hamclock.service with the editor of your choice, i.e:

sudo nano /etc/systemd/system/hamclock.service

The content of the file should be as follow:

[Unit]
Description=HamClock Service
After=multi-user.target
StartLimitIntervalSec=0

[Service]
Type=simple
User=your_user
Group=your_group
ExecStartPre=/bin/sleep 10
ExecStart=/home/your_user/ESPHamClock/hamclock-web-1600x960
WorkingDirectory=/home/your_user/ESPHamClock
Restart=always
RestartSec=5
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=%n

[Install]
WantedBy=multi-user.target

Make sure to replace your_user with the actual, non-privileged user you want this service to run as. Also adjust which binary you want to run. In the example I use binary for 1600×960 resolution.

Enable the service

Enabling the service makes it run automatically during the system boot. The command is:

sudo systemctl enable hamclock

Then start the service:

sudo systemctl start hamclock

You should be able now to check the status of the hamclock service:

sudo systemctl status hamclock

The output should look similar to the below:

● hamclock.service - HamClock Service
Loaded: loaded (/etc/systemd/system/hamclock.service; enabled; preset: enabled)
Active: active (running) since Sun 2025-06-22 12:04:27 CEST; 3s ago
Process: 14922 ExecStartPre=/bin/sleep 10 (code=exited, status=0/SUCCESS)
Main PID: 14923 (hamclock-web-16)
Tasks: 4 (limit: 2301)
Memory: 12.2M
CPU: 49ms
CGroup: /system.slice/hamclock.service
└─14923 /home/your_user/ESPHamClock/hamclock-web-1600x960

Restarting the service from time to time

My experience is that unfortunately after few days HamClock tends to have problems, including not working at all. Simple solution is to restart it every week, or even every night. Add this line to your /etc/crontab file:

30 3 * * * root /usr/bin/systemctl restart hamclock

(make sure that systemctl binary resides in /usr/bin directory in your system)

The above crontab entry will restart HamClock service every night, at 3:30 am. Adjust it to your needs.

Testing

Now you should be able to connect to your HamClock instance using the web browser. The URL is:

http://ip_or_host:8081/live.html

Of course use the IP address or hostname of the server you have just installed HamClock on.

You may also want to restart the server and check it HamClock service is automatically up and running.

Leave a comment