Panduan Lengkap Penjadwalan Tugas di Terminal Linux

🕒 Panduan Lengkap Penjadwalan Tugas di Terminal Linux​


schedule.png





🔹 1. Jadwal Otomatis dengan cron (Crontab)​


Cron adalah scheduler paling umum di semua distro Linux.


🔸 Format Crontab​


scss
CopyEdit
* * * * * perintah
│ │ │ │ │
│ │ │ │ └─ Hari (0=Min)
│ │ │ └── Bulan (1–12)
│ │ └─── Tanggal (1–31)
│ └──── Hari (0–23)
└───── Menit (0–59)


🔸 Edit Crontab​


Bash:
crontab -e


🔸 Contoh Perintah cron​


TujuanCrontab
Shutdown jam 23:00 setiap hari0 23 * * * /sbin/shutdown -h now
Jalankan backup setiap Minggu jam 2 pagi0 2 * * 0 /home/user/backup.sh
Jalankan script setiap 30 menit*/30 * * * * /home/user/script.sh
Jalankan script setiap 1 Januari0 0 1 1 * /home/user/newyear.sh
Reboot setiap Sabtu jam 23:3030 23 * * 6 /sbin/reboot


🔸 Lihat Crontab​


Bash:
crontab -l


🔸 Hapus Crontab​


Bash:
crontab -r




🔹 2. Penjadwalan Sekali Pakai dengan at​


at digunakan untuk menjadwalkan tugas sekali waktu.


🔸 Instal at (jika belum ada)​


Bash:
# Debian/Ubuntu
sudo apt install at
Bash:
# RHEL/Fedora
sudo dnf install at


🔸 Format Dasar​


Bash:
echo "perintah" | at waktu


🔸 Contoh at​


TujuanPerintah
Shutdown jam 23:00`echo "shutdown now"
Restart dalam 1 jam`echo "reboot"
Kirim pesan jam 5 sore`echo "echo 'Halo' >> ~/log.txt"


🔸 Cek Daftar Job​


Bash:
atq


🔸 Hapus Job​


Bash:
atrm JOB_ID




🔹 3. Penjadwalan Sistem (Service) dengan systemd timer​


Untuk distro modern yang memakai systemd (Ubuntu, Debian, Fedora, Arch, dll).


🔸 Contoh: Shutdown Otomatis​


1. Buat Service File​


Bash:
# /etc/systemd/system/shutdown-daily.service
[Unit]
Description=Shutdown otomatis harian

[Service]
Type=oneshot
ExecStart=/sbin/shutdown -h now


2. Buat Timer File​


Bash:
# /etc/systemd/system/shutdown-daily.timer
[Unit]
Description=Timer untuk shutdown harian

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

[Install]
WantedBy=timers.target


3. Aktifkan Timer​


Bash:
sudo systemctl daemon-reexec
sudo systemctl enable --now shutdown-daily.timer


🔸 Format OnCalendar​


FormatKeterangan
*-*-* 23:00:00Setiap hari jam 23:00
Mon..Fri 08:00Senin sampai Jumat jam 8
Sat 20:00Setiap Sabtu jam 20:00
2025-07-01 12:00:00Tanggal dan jam tertentu




🔹 4. Shutdown Otomatis dengan shutdown + sleep​


Bash:
sudo shutdown -h +60        # Shutdown dalam 60 menit
sudo shutdown -h 23:00      # Shutdown jam 23:00
sudo shutdown -c            # Cancel shutdown terjadwal




🔹 5. Gunakan sleep untuk Delay Tugas​


Bash:
sleep 3600 && shutdown now  # Shutdown dalam 1 jam
sleep 10m && your_script.sh




🧪 Contoh Use Case Jadwal Linux​


KasusSolusi
Shutdown jam 11 malam setiap haricron atau systemd timer
Jalankan skrip backup tiap Jumatcron
Jalankan script hanya sekali besok jam 9 pagiat
Restart server setiap minggucron atau systemd
Shutdown otomatis setelah 2 jamsleep && shutdown


About author
Administrator
ISE
ISE

Facebook Comment

Comments

There are no comments to display.

Linux information

Author
ISE
Article read time
2 min read
Views
139
Last update

More in Linux

More from ISE

Search Google Web Search Google Images Search Google Voice Search Google Videos Search Maps Translate Word
🔍
GE
Google Experiment
Visit Google Experiment
⋮
CS
Code Saya
Visit Code Saya
⋮
SK
Sekolah Koding
Visit Sekolah Koding
⋮
HF
Huggingface
Visit Huggingface
⋮
SL
Sololearn
Visit Sololearn
⋮
LM
Learnx
Visit Learnxinmyminutes
⋮
w3s
W3schools
Visit w3schools
⋮
CW
Codewars
Visit Codewars
⋮
GG
Geeksforgeeks
Visit Geeksforgeeks
⋮
EXC
Exercism
Visit Exercism
⋮
EDX
EDX
Visit EDX
⋮
Add Shortcut
WhatsApp

Customer Service

CS 1

Mr.Ibnu

Loading jadwal...

Hubungi via WhatsApp
CS 2

Mr.Husein

Loading jadwal...

Hubungi via WhatsApp
CS 3

Mr.Hasan

Loading jadwal...

Hubungi via WhatsApp
Top Bottom

Translate Website

Upload Custom Icon

coding Coding
programmer Programmer
webmaster Webmaster
banners.png Banners
Home
What's New Resources Media Gallery
Record your forum activity and save it as MP4
> INITIALIZING ISE CONNECTION...
> BYPASSING SECURITY PROTOCOLS...
> ESTABLISHING WORMHOLE LINK...
> Starting XenForo engine... [DONE]
> Calibrating singularity Hosting parameters... [DONE]
> Establishing Forum Style... [DONE]
> The Programmer Community ready in 3... 2... 1.