Sync OpenWrt Date from Custom Domain
03 February 2023 -
5 mins read time
Tags:
Timezone
Sync Time
OpenWrt
Bash
Shell
Page not found or adblock is active!
(1) Type URL correctly
(2) Enable javascript
(3) Disable adblock software, extensions, DNS, etc.
(4) Try another browser.
Then you can go to Home or go back to previous page.
Back to Previous PageAbout
- Sync date openwrt by picking date from selected domain.
- Support time sync after device connected to internet.
- Connection checker (If
cronmode used, script will checking a connection then restarting VPN apps after network re-connected) - Automatically set timezone following
LuCI - System - System - Timezonesetting. - Supported auto-restart VPN tunnels:
- OpenClash
- Passwall
- ShadowsocksR
- ShadowsocksR++
- v2ray
- v2rayA
- xray
- Libernet
- Xderm Mini
- Wegare STL
Tentang
- Sinkronisasi waktu pada OpenWrt dengan mengambil data waktu dari domain terpilih.
- Mendukung sinkronisasi waktu setelah modem/koneksi internet tersedia.
- Pemeriksa koneksi (jika menggunakan mode
cron, maka script akan memeriksa koneksi, lalu merestart aplikasi VPN jika koneksi internet tidak tersedia) - Pengaturan timezone (zona waktu) secara otomatis mengikuti pengaturan
LuCI - System - System - Timezone. - Mendukung autorestart VPN tunnels:
- OpenClash
- Passwall
- ShadowsocksR
- ShadowsocksR++
- v2ray
- v2rayA
- xray
- Libernet
- Xderm Mini
- Wegare STL
How This Script Work
- When OpenWrt restarting, script will
checking for network connection. - If no network detected, script will
re-checking connection until device reconnected. - After device connected to internet, script will
synchronize OpenWrt time. - If device have
running VPN/Tunneling, script willrestarting VPN appbefore time sync.
Cara Kerja Script Ini
- Setelah OpenWrt restart, script akan
memeriksa koneksi internetterlebih dahulu. - Jika internet belum tersedia, script akan
mengulangi pemeriksaan koneksi sampai koneksi terhubung. - Ketika koneksi sudah terhubung, script akan
melakukan sinkronisasi waktu. - Jika ada
aplikasi VPN/Tunneling yang berjalan, script akanmerestart aplikasi VPN yang digunakansebelum melakukan sinkronisasi waktu.
Installation
-
Install
needs dependenciesfirst by opening Terminal/Putty/XTERM/etc:opkg update && opkg install curl wget -
Download
jam.shscript by copy and paste command below to terminal (choose only one of below commands)wgetinstallation:wget --no-check-certificate "https://raw.githubusercontent.com/vitoharhari/sync-date-openwrt-with-bug/main/jam.sh" -O /usr/bin/jam.sh && chmod +x /usr/bin/jam.shcurlinstallation:curl -sL raw.githubusercontent.com/vitoharhari/sync-date-openwrt-with-bug/main/jam.sh > /usr/bin/jam.sh && chmod +x /usr/bin/jam.sh -
Run command below to add
jam.shtoLuCI -> System -> Startup -> Local Startupecho -e "#jam.sh autoboot\n/usr/bin/jam.sh time2.google.com" > /etc/rc.local -
If you desire to use
LuCI -> System -> Schedule Tasksorcrontab(check connection every hour, then restart vpn if no connection available), just run command below:echo -e "#jam.sh cron\n0 * * * * /usr/bin/jam.sh time2.google.com cron\n" > /etc/crontabs/root- For cron time customization, see crontab.guru to create your own cron time.
Pemasangan
-
Install
paket yang dibutuhkanterlebih dahulu dengan membuka terminal/putty/dsb:opkg update && opkg install curl wget -
Jalankan command dibawah untuk memasang script
jam.sh(pilih salah satu saja)Pemasangan menggunakan
wgetwget --no-check-certificate "https://raw.githubusercontent.com/vitoharhari/sync-date-openwrt-with-bug/main/jam.sh" -O /usr/bin/jam.sh && chmod +x /usr/bin/jam.shPemasangan menggunakan
curlcurl -sL raw.githubusercontent.com/vitoharhari/sync-date-openwrt-with-bug/main/jam.sh > /usr/bin/jam.sh && chmod +x /usr/bin/jam.sh -
Jalankan command dibawah di terminal untuk menambahkan
jam.shkeLuCI -> System -> Startup -> Local Startup:echo -e "#jam.sh autoboot\n/usr/bin/jam.sh time2.google.com" > /etc/rc.local -
Jika menggunakan
LuCI -> System -> Schedule Tasksatau disebut jugacrontab(memeriksa koneksi setiap jam, lalu me-restart vpn jika koneksi tidak tersedia), jalankan perintah dibawah ini:echo -e "#jam.sh cron\n0 * * * * /usr/bin/jam.sh time2.google.com cron\n" > /etc/crontabs/root- Untuk kustomisasi waktu cron lainnya dapat dilihat di crontab.guru
Advanced Usage
-
Change
time2.google.comwithbug/domainyou choose. Example:/usr/bin/jam.sh m.youtu.be -
Jika menggunakan
0p0k Telkomselsilahkan tambahkan:443dibelakang bug. Example:/usr/bin/jam.sh time2.google.com:443 -
Jika ingin melakukan
update/pembaruan script, silahkan lakukan perintah dibawah ini./usr/bin/jam.sh updateTanda update berhasil adalah seperti ini:
jam.sh: Updating script... jam.sh: Downloading script update... jam.sh: Update done... jam.sh: update file cleaned up! Usage: add domain/bug after script!. jam.sh: Missing URL/Bug/Domain!. Read https://github.com/vitoharhari/sync-date-openwrt-with-bug/blob/main/README.md for details.
Pemakaian Lanjutan
-
Ganti
time2.google.comdenganbug/domainkesayangan anda. Contoh:/usr/bin/jam.sh m.youtu.be -
Jika menggunakan
0p0k Telkomselsilahkan tambahkan:443dibelakang bug. Contoh:/usr/bin/jam.sh time2.google.com:443 -
Jika ingin melakukan
update/pembaruan script, silahkan lakukan perintah dibawah ini./usr/bin/jam.sh updateTanda update berhasil adalah seperti ini:
jam.sh: Updating script... jam.sh: Downloading script update... jam.sh: Update done... jam.sh: update file cleaned up! Usage: add domain/bug after script!. jam.sh: Missing URL/Bug/Domain!. Read https://github.com/vitoharhari/sync-date-openwrt-with-bug/blob/main/README.md for details.
Developers
- Base script and more enhancement codes from AlkhaNet by Teguh Surya Mungaran
- GMT codes and more enhancement codes by Vito H.S
- opkg checker and installer, internet checker, vpn manager, gmt selection codes by Helmi Amirudin