How to Set NTP via Command Line

How to Set NTP via Command Line

Understanding the Configuration Structure

First, it's helpful to understand how to access the complete configuration structure:
1. You can download the XML configuration from:
  1. Web UI → System → Profile → XML Configuration File → Generate → Download

2. To view current settings from the command line, use:
sudo uci print | grep ntp

Setting NTP Configuration via Command Line

Follow these steps to configure NTP settings:
#Enable NTP client

sudo uci set ntp.client_enable true

#Set primary NTP server

sudo uci set ntp.primary_server "pool.ntp.org"

#Set secondary NTP server

sudo uci set ntp.secondary_server "time.google.com"

#Set timezone (format uses 0 instead of / in timezone name)

sudo uci set ntp.timezone "Europe0Budapest"  # Replace with your timezone

#Set update interval in minutes

sudo uci set ntp.update_interval 60

#Enable/disable NTP server functionality

sudo uci set ntp.server_enable false

#Save changes to persistent storage

sudo uci save

#Apply changes immediately

sudo uci apply

Verifying NTP Configuration

After applying changes, verify the settings:
#Check specific NTP settings
sudo uci get ntp.primary_server
sudo uci get ntp.timezone

#View all NTP settings

sudo uci print | grep ntp

Important Notes

1. Timezone Format: ROS PRO uses a non-standard format for timezones, replacing the slash (/) with zero (0). For example:
  1. Europe0Budapest instead of Europe/Budapest
  2. Asia0Shanghai instead of Asia/Shanghai
2. Error Handling: If you receive a "values verify error" message, it means your input doesn't match the expected format or allowed values.
3. Valid Timezones: When setting the timezone, make sure to use a valid timezone in the correct format. If unsure, check the current value with sudo uci get ntp.timezone first.

Using these commands, you can automate NTP configuration from your Debian environment without using the web interface.
    • Related Articles

    • How to Enable RCMS via Configuration File

      Overview This guide explains how to configure RCMS settings using a config.xml file, which can be deployed via: Web UI USB drive Complete RCMS Configuration Block <rcms> <enable>true</enable> <rlink_enable>true</rlink_enable> ...
    • How to Set up Ping Detection

      Why Ping Detection is Critical Ping detection serves as an essential keep-alive mechanism for your RCMS (Remote Cloud Monitoring Solution) connectivity. This feature: Actively monitors real-time connectivity to the RCMS platform Identifies network ...
    • How to Set up Python Scripts with Crontab

      Note: This method is applicable to all EG Series/RobustOS Pro devices Author: Eldar Mustafin 1. Creating a Python Script First, create your Python script with proper logging and error handling. Here's a template: #!/usr/bin/env python3 import logging ...
    • How to Set up Bidirectional SMS Integration with Telegram

      This guide describes how to set up bidirectional SMS integration with Telegram on a RobustOS Pro device. After setup, you'll be able to: Receive device SMS messages in your Telegram chat Send SMS from Telegram using simple commands Prerequisites ...
    • How to Enable RCMS via SMS

      Prerequisites 1. Device mobile number 2. Admin credentials 3. RCMS server details: Server IP/URL Port number Primary server IP for ping detection SMS Configuration Command Send the following SMS command to the device: admin:admin; set rcms enable ...