$ sudo crontab -u www-data -e
sudo: crontab: command not found
utuhglobal@moodle-vm:~$ sudo apt update
Hit:1 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:4 https://packages.cloud.google.com/apt google-cloud-ops-agent-jammy-2 InRelease
Hit:6 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:5 https://dlm.mariadb.com/repo/mariadb-server/10.11/repo/ubuntu jammy InRelease
Hit:7 https://dlm.mariadb.com/repo/maxscale/latest/apt jammy InRelease
Hit:9 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy InRelease
Hit:8 https://downloads.mariadb.com/Tools/ubuntu jammy InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
34 packages can be upgraded. Run 'apt list --upgradable' to see them.
utuhglobal@moodle-vm:~$ sudo apt install cron
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
anacron checksecurity default-mta | mail-transport-agent
The following NEW packages will be installed:
cron
0 upgraded, 1 newly installed, 0 to remove and 34 not upgraded.
Need to get 73.7 kB of archives.
After this operation, 261 kB of additional disk space will be used.
Get:1 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy/main amd64 cron amd64 3.0pl1-137ubuntu3 [73.7 kB]
Fetched 73.7 kB in 0s (2521 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package cron.
(Reading database ... 58521 files and directories currently installed.)
Preparing to unpack .../cron_3.0pl1-137ubuntu3_amd64.deb ...
Unpacking cron (3.0pl1-137ubuntu3) ...
Setting up cron (3.0pl1-137ubuntu3) ...
Adding group `crontab' (GID 121) ...
Done.
Created symlink /etc/systemd/system/multi-user.target.wants/cron.service → /lib/systemd/system/cron.service.
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.)
debconf: falling back to frontend: Readline
Scanning processes...
Scanning linux images...
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
utuhglobal@moodle-vm:~$ which crontab
/usr/bin/crontab
utuhglobal@moodle-vm:~$ dpkg -l | grep cron
ii cron 3.0pl1-137ubuntu3 amd64 process scheduling daemon
utuhglobal@moodle-vm:~$ sudo crontab -u www-data -e
no crontab for www-data - using an empty one
crontab: installing new crontab
✅ 2. Tambahkan baris cron berikut
Di dalam file crontab yang terbuka, tambahkan baris ini:
*/1 * * * * /usr/bin/php /var/www/html/moodle/admin/cli/cron.php >/dev/null 2>&1
Artinya: jalankan cron.php
setiap 1 menit. Output diarahkan ke null
agar tidak membanjiri log.
utuhglobal@moodle-vm:~$ sudo tail -n 30 /var/log/syslog
Jun 4 00:48:35 moodle-vm rsyslogd: action 'action-8-builtin:omfile' resumed (module 'builtin:omfile') [v8.2112.0 try https://www.rsyslog.com/e/2359 ]
Jun 4 00:48:35 moodle-vm rsyslogd: action 'action-8-builtin:omfile' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspension. [v8.2112.0 try https://www.rsyslog.com/e/2007 ]
Jun 4 00:48:35 moodle-vm rsyslogd: action 'action-8-builtin:omfile' resumed (module 'builtin:omfile') [v8.2112.0 try https://www.rsyslog.com/e/2359 ]
Jun 4 00:48:35 moodle-vm rsyslogd: action 'action-8-builtin:omfile' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspension. [v8.2112.0 try https://www.rsyslog.com/e/2007 ]
Jun 4 00:48:35 moodle-vm rsyslogd: action 'action-8-builtin:omfile' resumed (module 'builtin:omfile') [v8.2112.0 try https://www.rsyslog.com/e/2359 ]
Jun 4 00:48:35 moodle-vm rsyslogd: action 'action-8-builtin:omfile' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspension. [v8.2112.0 try https://www.rsyslog.com/e/2007 ]
Jun 4 00:48:35 moodle-vm rsyslogd: action 'action-8-builtin:omfile' resumed (module 'builtin:omfile') [v8.2112.0 try https://www.rsyslog.com/e/2359 ]
Jun 4 00:48:35 moodle-vm rsyslogd: action 'action-8-builtin:omfile' suspended (module 'builtin:omfile'), retry 0. There should be messages before this one giving the reason for suspension. [v8.2112.0 try https://www.rsyslog.com/e/2007 ]
Jun 4 00:48:35 moodle-vm rsyslogd: action 'action-8-builtin:omfile' suspended (module 'builtin:omfile'), next retry is Wed Jun 4 00:49:05 2025, retry nbr 0. There should be messages before this one giving the reason for suspension. [v8.2112.0 try https://www.rsyslog.com/e/2007 ]
Jun 4 00:48:35 moodle-vm systemd[1]: Starting Update the local ESM caches...
Jun 4 00:48:35 moodle-vm systemd[1]: apt-news.service: Deactivated successfully.
Jun 4 00:48:35 moodle-vm systemd[1]: Finished Update APT News.
Jun 4 00:48:36 moodle-vm systemd[1]: esm-cache.service: Deactivated successfully.
Jun 4 00:48:36 moodle-vm systemd[1]: Finished Update the local ESM caches.
Jun 4 00:48:45 moodle-vm systemd[1]: Reloading.
Jun 4 00:48:45 moodle-vm systemd[1]: Configuration file /run/systemd/system/netplan-ovs-cleanup.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
Jun 4 00:48:45 moodle-vm systemd[1]: /lib/systemd/system/snapd.service:23: Unknown key name 'RestartMode' in section 'Service', ignoring.
Jun 4 00:48:45 moodle-vm systemd[1]: Reloading.
Jun 4 00:48:45 moodle-vm systemd[1]: Configuration file /run/systemd/system/netplan-ovs-cleanup.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
Jun 4 00:48:45 moodle-vm systemd[1]: /lib/systemd/system/snapd.service:23: Unknown key name 'RestartMode' in section 'Service', ignoring.
Jun 4 00:48:46 moodle-vm systemd[1]: Reloading.
Jun 4 00:48:46 moodle-vm systemd[1]: Configuration file /run/systemd/system/netplan-ovs-cleanup.service is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
Jun 4 00:48:46 moodle-vm systemd[1]: /lib/systemd/system/snapd.service:23: Unknown key name 'RestartMode' in section 'Service', ignoring.
Jun 4 00:48:46 moodle-vm systemd[1]: Started Regular background program processing daemon.
Jun 4 00:48:46 moodle-vm cron[164323]: (CRON) INFO (pidfile fd = 3)
Jun 4 00:48:46 moodle-vm cron[164323]: (CRON) INFO (Running @reboot jobs)
Jun 4 00:50:51 moodle-vm crontab[164451]: (root) BEGIN EDIT (www-data)
Jun 4 00:51:55 moodle-vm crontab[164451]: (root) REPLACE (www-data)
Jun 4 00:51:55 moodle-vm crontab[164451]: (root) END EDIT (www-data)
Jun 4 00:52:01 moodle-vm CRON[164462]: (www-data) CMD (/usr/bin/php /var/www/html/moodle/admin/cli/cron.php >/dev/null 2>&1)
utuhglobal@moodle-vm:~$ which php
/usr/bin/php
utuhglobal@moodle-vm:~$ ls /var/www/html
index-asli.html moodle
utuhglobal@moodle-vm:~$ sudo crontab -u www-data -e
0 comments:
Post a Comment