{"id":581,"date":"2024-06-21T08:49:00","date_gmt":"2024-06-21T01:49:00","guid":{"rendered":"https:\/\/blog.tinohost.com\/?p=581"},"modified":"2026-10-26T10:27:33","modified_gmt":"2026-10-26T03:27:33","slug":"cron-jobs-la-gi","status":"publish","type":"post","link":"https:\/\/tino.vn\/blog\/cron-jobs-la-gi\/","title":{"rendered":"Cron Jobs l\u00e0 g\u00ec? C\u00fa ph\u00e1p, v\u00ed d\u1ee5 v\u00e0 c\u00e1ch t\u1ea1o cron job tr\u00ean hosting"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Cron job l\u00e0 m\u1ed9t l\u1ec7nh ho\u1eb7c script \u0111\u01b0\u1ee3c h\u1eb9n gi\u1edd \u0111\u1ec3 m\u00e1y ch\u1ee7 Linux t\u1ef1 ch\u1ea1y l\u1eb7p l\u1ea1i theo l\u1ecbch, v\u00ed d\u1ee5 m\u1ed7i 15 ph\u00fat, 2 gi\u1edd s\u00e1ng m\u1ed7i ng\u00e0y hay ng\u00e0y 1 h\u1eb1ng th\u00e1ng.<\/strong> Ch\u01b0\u01a1ng tr\u00ecnh ch\u1ea1y n\u1ec1n <em>cron<\/em> \u0111\u1ecdc l\u1ecbch, \u0111\u1ebfn \u0111\u00fang ph\u00fat th\u00ec th\u1ef1c thi l\u1ec7nh, kh\u00f4ng c\u1ea7n ai m\u1edf m\u00e1y hay b\u1ea5m n\u00fat. Tr\u00ean hosting, b\u1ea1n t\u1ea1o cron job trong m\u1ee5c <strong>Cron Jobs<\/strong> c\u1ee7a cPanel (ho\u1eb7c Cronjobs c\u1ee7a DirectAdmin) \u0111\u1ec3 ch\u1ea1y backup, g\u1eedi email, \u0111\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u, g\u1ecdi wp-cron.php.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">B\u00e0i thu\u1ed9c nh\u00f3m h\u01b0\u1edbng d\u1eabn <a href=\"https:\/\/tino.vn\/blog\/truy-cap-va-lay-thong-tin-hosting-tai-tino\/\">qu\u1ea3n tr\u1ecb website tr\u00ean hosting<\/a>; n\u1ec1n t\u1ea3ng v\u1ec1 hosting xem \u1edf <a href=\"https:\/\/tino.vn\/blog\/hosting-la-gi\/\">hosting l\u00e0 g\u00ec<\/a>. N\u1ebfu b\u1ea1n qu\u1ea3n tr\u1ecb VPS v\u00e0 c\u1ea7n c\u00e1c l\u1ec7nh <code>crontab -e<\/code>, <code>crontab -l<\/code>, \u0111\u1ecdc ti\u1ebfp b\u00e0i <a href=\"https:\/\/tino.vn\/blog\/crontab-la-gi\/\">crontab l\u00e0 g\u00ec v\u00e0 c\u00e1ch d\u00f9ng tr\u00ean Linux<\/a>.<\/p>\n\n\n\n<h2 id=\"Cron_Jobs_l\u00e0_g\u00ec?\">Cron Jobs l\u00e0 g\u00ec?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Cron Jobs l\u00e0 c\u00e1c t\u00e1c v\u1ee5 \u0111\u1ecbnh k\u1ef3 do d\u1ecbch v\u1ee5 cron tr\u00ean Unix\/Linux qu\u1ea3n l\u00fd: m\u1ed7i t\u00e1c v\u1ee5 l\u00e0 m\u1ed9t d\u00f2ng g\u1ed3m th\u1eddi \u0111i\u1ec3m ch\u1ea1y v\u00e0 l\u1ec7nh c\u1ea7n ch\u1ea1y. Theo <a href=\"https:\/\/manpages.ubuntu.com\/manpages\/noble\/man8\/cron.8.html\" target=\"_blank\" rel=\"noopener nofollow\">t\u00e0i li\u1ec7u cron(8) c\u1ee7a Ubuntu<\/a>, cron ki\u1ec3m tra c\u00e1c b\u1ea3ng l\u1ecbch m\u1ed7i ph\u00fat v\u00e0 ch\u1ea1y nh\u1eefng l\u1ec7nh kh\u1edbp v\u1edbi ph\u00fat hi\u1ec7n t\u1ea1i.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ba kh\u00e1i ni\u1ec7m hay b\u1ecb d\u00f9ng l\u1eabn:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>cron<\/strong>: ch\u01b0\u01a1ng tr\u00ecnh ch\u1ea1y n\u1ec1n (daemon) l\u00e0m nhi\u1ec7m v\u1ee5 \u0111\u1ebfm gi\u1edd v\u00e0 th\u1ef1c thi.<\/li>\n\n\n<li><strong>crontab<\/strong> (cron table): b\u1ea3ng l\u1ecbch c\u1ee7a t\u1eebng ng\u01b0\u1eddi d\u00f9ng, \u0111\u1ed3ng th\u1eddi l\u00e0 t\u00ean l\u1ec7nh \u0111\u1ec3 s\u1eeda b\u1ea3ng \u0111\u00f3.<\/li>\n\n\n<li><strong>cron job<\/strong>: m\u1ed9t d\u00f2ng l\u1ecbch c\u1ee5 th\u1ec3 trong b\u1ea3ng, v\u00ed d\u1ee5 \u201c2 gi\u1edd s\u00e1ng ch\u1ea1y backup.sh\u201d.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Windows kh\u00f4ng c\u00f3 cron; t\u00ednh n\u0103ng t\u01b0\u01a1ng \u0111\u01b0\u01a1ng l\u00e0 Task Scheduler. V\u00ec hosting cPanel\/DirectAdmin ch\u1ea1y Linux n\u00ean cron c\u00f3 s\u1eb5n, b\u1ea1n ch\u1ec9 c\u1ea7n quy\u1ec1n d\u00f9ng m\u1ee5c Cron Jobs.<\/p>\n\n\n\n<h3 id=\"Cron_Jobs_\u0111\u01b0\u1ee3c_s\u1eed_d\u1ee5ng_\u0111\u1ec3_l\u00e0m_g\u00ec?\">Cron Jobs \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u00e0m g\u00ec?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Cron Jobs d\u00f9ng \u0111\u1ec3 t\u1ef1 \u0111\u1ed9ng ho\u00e1 vi\u1ec7c l\u1eb7p l\u1ea1i theo gi\u1edd c\u1ed1 \u0111\u1ecbnh tr\u00ean m\u00e1y ch\u1ee7. V\u1edbi website tr\u00ean hosting, c\u00e1c vi\u1ec7c ph\u1ed5 bi\u1ebfn l\u00e0:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Sao l\u01b0u d\u1eef li\u1ec7u:<\/strong> n\u00e9n m\u00e3 ngu\u1ed3n, xu\u1ea5t database v\u00e0o th\u01b0 m\u1ee5c backup m\u1ed7i \u0111\u00eam.<\/li>\n\n\n<li><strong>Ch\u1ea1y t\u00e1c v\u1ee5 c\u1ee7a \u1ee9ng d\u1ee5ng:<\/strong> WordPress (wp-cron.php), Laravel (<code>schedule:run<\/code>), Magento, WHMCS \u0111\u1ec1u c\u1ea7n cron \u0111\u1ec3 x\u1eed l\u00fd h\u00e0ng \u0111\u1ee3i, email, ho\u00e1 \u0111\u01a1n.<\/li>\n\n\n<li><strong>G\u1eedi email th\u00f4ng b\u00e1o:<\/strong> b\u1ea3n tin, nh\u1eafc gia h\u1ea1n, b\u00e1o c\u00e1o \u0111\u01a1n h\u00e0ng.<\/li>\n\n\n<li><strong>X\u1eed l\u00fd d\u1eef li\u1ec7u:<\/strong> d\u1ecdn file t\u1ea1m, xo\u00e1 log c\u0169, \u0111\u1ed3ng b\u1ed9 t\u1ed3n kho, t\u1ea1o sitemap.<\/li>\n<\/ul>\n\n\n\n<h3 id=\"Nguy\u00ean_l\u00ed_ho\u1ea1t_\u0111\u1ed9ng_c\u1ee7a_Cron_Jobs\">Nguy\u00ean l\u00ed ho\u1ea1t \u0111\u1ed9ng c\u1ee7a Cron Jobs<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">M\u1ed9t cron job c\u00f3 ba ph\u1ea7n c\u1ed1 \u0111\u1ecbnh:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>L\u1ecbch:<\/strong> 5 tr\u01b0\u1eddng th\u1eddi gian cho bi\u1ebft khi n\u00e0o ch\u1ea1y.<\/li>\n\n\n<li><strong>L\u1ec7nh:<\/strong> c\u00e2u l\u1ec7nh ho\u1eb7c \u0111\u01b0\u1eddng d\u1eabn script c\u1ea7n th\u1ef1c thi, th\u01b0\u1eddng l\u00e0 PHP CLI hay shell script.<\/li>\n\n\n<li><strong>\u0110\u1ea7u ra:<\/strong> m\u1ecdi th\u1ee9 l\u1ec7nh in ra m\u00e0n h\u00ecnh. cron g\u1eedi \u0111\u1ea7u ra n\u00e0y qua email cho ch\u1ee7 t\u00e0i kho\u1ea3n (ho\u1eb7c \u0111\u1ecba ch\u1ec9 trong bi\u1ebfn MAILTO), tr\u1eeb khi b\u1ea1n chuy\u1ec3n n\u00f3 v\u00e0o file log hay <code>\/dev\/null<\/code>.<\/li>\n<\/ol>\n\n\n\n<h2 id=\"C\u00fa_ph\u00e1p_cron_g\u1ed3m_nh\u1eefng_g\u00ec?\">C\u00fa ph\u00e1p cron g\u1ed3m nh\u1eefng g\u00ec?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">C\u00fa ph\u00e1p cron g\u1ed3m 5 tr\u01b0\u1eddng th\u1eddi gian c\u00e1ch nhau b\u1eb1ng d\u1ea5u c\u00e1ch, ti\u1ebfp theo l\u00e0 l\u1ec7nh. Th\u1ee9 t\u1ef1 lu\u00f4n l\u00e0 ph\u00fat, gi\u1edd, ng\u00e0y trong th\u00e1ng, th\u00e1ng, th\u1ee9 trong tu\u1ea7n; d\u1ea5u <code>*<\/code> ngh\u0129a l\u00e0 \u201cm\u1ecdi gi\u00e1 tr\u1ecb\u201d (<a href=\"https:\/\/manpages.ubuntu.com\/manpages\/noble\/man5\/crontab.5.html\" target=\"_blank\" rel=\"noopener nofollow\">man crontab(5), Ubuntu 24.04<\/a>).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1400\" height=\"750\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cron-jobs-la-gi-cu-phap-5-truong.webp\" alt=\"S\u01a1 \u0111\u1ed3 m\u1ed9t d\u00f2ng cron: *\/15 2-5 * * 1-5 k\u00e8m l\u1ec7nh PHP, ch\u00fa th\u00edch ph\u1ea1m vi t\u1eebng tr\u01b0\u1eddng ph\u00fat, gi\u1edd, ng\u00e0y, th\u00e1ng, th\u1ee9 v\u00e0 \u00fd ngh\u0129a c\u00e1c k\u00fd hi\u1ec7u * , - \/ @daily\" class=\"wp-image-132181\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cron-jobs-la-gi-cu-phap-5-truong.webp 1400w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cron-jobs-la-gi-cu-phap-5-truong-300x161.webp 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cron-jobs-la-gi-cu-phap-5-truong-1024x549.webp 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cron-jobs-la-gi-cu-phap-5-truong-768x411.webp 768w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">M\u1ed9t s\u1ed1 \u0111i\u1ec3m b\u00e0i c\u0169 v\u00e0 nhi\u1ec1u t\u00e0i li\u1ec7u tr\u00ean m\u1ea1ng vi\u1ebft sai:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Tr\u01b0\u1eddng th\u1ee9 nh\u1eadn <strong>0\u20137<\/strong>, trong \u0111\u00f3 c\u1ea3 0 v\u00e0 7 \u0111\u1ec1u l\u00e0 Ch\u1ee7 nh\u1eadt; <code>1-5<\/code> l\u00e0 th\u1ee9 Hai \u0111\u1ebfn th\u1ee9 S\u00e1u, <code>2-4<\/code> l\u00e0 th\u1ee9 Ba \u0111\u1ebfn th\u1ee9 N\u0103m.<\/li>\n\n\n<li>C\u00f3 th\u1ec3 vi\u1ebft t\u00ean thay s\u1ed1: <code>mon,wed,fri<\/code>, <code>jan-mar<\/code>.<\/li>\n\n\n<li>K\u00fd hi\u1ec7u <code>L<\/code>, <code>W<\/code>, <code>#<\/code>, <code>?<\/code> v\u00e0 tr\u01b0\u1eddng gi\u00e2y l\u00e0 c\u00fa ph\u00e1p c\u1ee7a Quartz (Java) hay m\u1ed9t s\u1ed1 d\u1ecbch v\u1ee5 \u0111\u00e1m m\u00e2y, <strong>kh\u00f4ng<\/strong> d\u00f9ng \u0111\u01b0\u1ee3c trong crontab c\u1ee7a Linux.<\/li>\n\n\n<li>Khi c\u1ea3 \u201cng\u00e0y trong th\u00e1ng\u201d v\u00e0 \u201cth\u1ee9\u201d c\u00f9ng b\u1ecb gi\u1edbi h\u1ea1n, l\u1ec7nh ch\u1ea1y khi <strong>m\u1ed9t trong hai<\/strong> kh\u1edbp. V\u00ed d\u1ee5 <code>30 4 1,15 * 5<\/code> ch\u1ea1y l\u00fac 4:30 ng\u00e0y 1, ng\u00e0y 15 <em>v\u00e0<\/em> m\u1ecdi th\u1ee9 S\u00e1u.<\/li>\n\n\n<li>K\u00fd t\u1ef1 <code>%<\/code> trong l\u1ec7nh b\u1ecb cron \u0111\u1ed5i th\u00e0nh xu\u1ed1ng d\u00f2ng; mu\u1ed1n d\u00f9ng (v\u00ed d\u1ee5 trong <code>date +%F<\/code>) ph\u1ea3i vi\u1ebft <code>\\%<\/code>.<\/li>\n<\/ul>\n\n\n\n<h3 id=\"V\u00ed_d\u1ee5_l\u1ecbch_cron_hay_d\u00f9ng\">V\u00ed d\u1ee5 l\u1ecbch cron hay d\u00f9ng<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Bi\u1ec3u th\u1ee9c<\/th><th>\u00dd ngh\u0129a<\/th><th>D\u00f9ng cho<\/th><\/tr><\/thead><tbody><tr><td><code>*\/5 * * * *<\/code><\/td><td>M\u1ed7i 5 ph\u00fat<\/td><td>H\u00e0ng \u0111\u1ee3i email, wp-cron.php<\/td><\/tr><tr><td><code>0 * * * *<\/code><\/td><td>Ph\u00fat 0 c\u1ee7a m\u1ed7i gi\u1edd<\/td><td>\u0110\u1ed3ng b\u1ed9 d\u1eef li\u1ec7u, sitemap<\/td><\/tr><tr><td><code>30 2 * * *<\/code><\/td><td>2:30 s\u00e1ng m\u1ed7i ng\u00e0y<\/td><td>Backup database, m\u00e3 ngu\u1ed3n (<a href=\"https:\/\/tino.vn\/blog\/cach-backup-website-wordpress\/\">backup WordPress<\/a>)<\/td><\/tr><tr><td><code>0 8 * * 1-5<\/code><\/td><td>8:00 th\u1ee9 Hai \u0111\u1ebfn th\u1ee9 S\u00e1u<\/td><td>B\u00e1o c\u00e1o ng\u00e0y l\u00e0m vi\u1ec7c<\/td><\/tr><tr><td><code>0 0 1 * *<\/code><\/td><td>0:00 ng\u00e0y 1 h\u1eb1ng th\u00e1ng<\/td><td>Xo\u00e1 log c\u0169, ch\u1ed1t s\u1ed1 li\u1ec7u th\u00e1ng<\/td><\/tr><tr><td><code>0 3 * * 0<\/code><\/td><td>3:00 s\u00e1ng Ch\u1ee7 nh\u1eadt<\/td><td>D\u1ecdn file t\u1ea1m, t\u1ed1i \u01b0u b\u1ea3ng<\/td><\/tr><tr><td><code>15 1 1,15 * *<\/code><\/td><td>1:15 s\u00e1ng c\u00e1c ng\u00e0y 1, 15<\/td><td>Ho\u00e1 \u0111\u01a1n, nh\u1eafc gia h\u1ea1n<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">Gi\u1edd ch\u1ea1y t\u00ednh theo m\u00fai gi\u1edd c\u1ee7a m\u00e1y ch\u1ee7 hosting<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Cron c\u00f2n c\u00f3 c\u00e1c chu\u1ed7i t\u1eaft thay cho 5 tr\u01b0\u1eddng: <code>@hourly<\/code> (= <code>0 * * * *<\/code>), <code>@daily<\/code> (= <code>0 0 * * *<\/code>), <code>@weekly<\/code> (= <code>0 0 * * 0<\/code>), <code>@monthly<\/code> (= <code>0 0 1 * *<\/code>), <code>@yearly<\/code> (= <code>0 0 1 1 *<\/code>) v\u00e0 <code>@reboot<\/code> (ch\u1ea1y m\u1ed9t l\u1ea7n sau khi m\u00e1y kh\u1edfi \u0111\u1ed9ng). \u00d4 nh\u1eadp trong cPanel chia s\u1eb5n 5 tr\u01b0\u1eddng n\u00ean d\u00f9ng chu\u1ed7i t\u1eaft ch\u1ee7 y\u1ebfu khi s\u1eeda crontab tr\u1ef1c ti\u1ebfp tr\u00ean VPS.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0110\u1ec3 ki\u1ec3m tra nhanh m\u1ed9t bi\u1ec3u th\u1ee9c, d\u00e1n v\u00e0o <a href=\"https:\/\/crontab.guru\/\" target=\"_blank\" rel=\"noopener nofollow\">crontab.guru<\/a>: trang n\u00e0y di\u1ec5n gi\u1ea3i bi\u1ec3u th\u1ee9c th\u00e0nh c\u00e2u v\u00e0 li\u1ec7t k\u00ea c\u00e1c l\u1ea7n ch\u1ea1y ti\u1ebfp theo.<\/p>\n\n\n\n<h2 id=\"C\u00e1ch_t\u1ea1o_Cron_Jobs_tr\u00ean_hosting_cPanel\">C\u00e1ch t\u1ea1o Cron Jobs tr\u00ean hosting cPanel<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Tr\u00ean hosting cPanel, cron job \u0111\u01b0\u1ee3c t\u1ea1o trong m\u1ee5c <strong>Advanced \u2192 Cron Jobs<\/strong>: ch\u1ecdn l\u1ecbch, nh\u1eadp l\u1ec7nh c\u00f3 \u0111\u01b0\u1eddng d\u1eabn \u0111\u1ea7y \u0111\u1ee7 r\u1ed3i b\u1ea5m Add New Cron Job. Kh\u00f4ng c\u1ea7n c\u00e0i th\u00eam g\u00ec; nh\u00e0 cung c\u1ea5p ch\u1ec9 c\u1ea7n b\u1eadt t\u00ednh n\u0103ng n\u00e0y cho g\u00f3i (<a href=\"https:\/\/docs.cpanel.net\/cpanel\/advanced\/cron-jobs\/\" target=\"_blank\" rel=\"noopener nofollow\">t\u00e0i li\u1ec7u cPanel: Cron Jobs<\/a>). C\u00e1ch v\u00e0o cPanel xem \u1edf <a href=\"https:\/\/tino.vn\/blog\/cpanel-la-gi\/\">cPanel l\u00e0 g\u00ec<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>B\u01b0\u1edbc 1:<\/strong> Truy c\u1eadp v\u00e0o cPanel th\u00f4ng qua trang qu\u1ea3n l\u00fd hosting c\u1ee7a b\u1ea1n.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>B\u01b0\u1edbc 2:<\/strong> K\u00e9o xu\u1ed1ng ph\u1ea7n <strong>Advanced<\/strong> (N\u00e2ng cao) \u2192 ch\u1ecdn <strong>Cron Jobs<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2024\/05\/cron-jobs-la-gi-6.png\" alt=\"M\u1ee5c Advanced trong cPanel, khung \u0111\u1ecf \u0111\u00e1nh d\u1ea5u bi\u1ec3u t\u01b0\u1ee3ng Cron Jobs\" class=\"wp-image-95010\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2024\/05\/cron-jobs-la-gi-6.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2024\/05\/cron-jobs-la-gi-6-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>B\u01b0\u1edbc 3:<\/strong> Giao di\u1ec7n t\u1ea1o Cron Jobs s\u1ebd xu\u1ea5t hi\u1ec7n.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Trong ph\u1ea7n <strong>Common Settings<\/strong>, ch\u1ecdn t\u1ea7n su\u1ea5t c\u00f3 s\u1eb5n (Once Per Hour, Once Per Day\u2026); cPanel t\u1ef1 \u0111i\u1ec1n 5 \u00f4 b\u00ean d\u01b0\u1edbi.<\/li>\n\n\n<li>Ho\u1eb7c t\u1ef1 c\u1ea5u h\u00ecnh c\u00e1c tr\u01b0\u1eddng <strong>Minute<\/strong>, <strong>Hour<\/strong>, <strong>Day<\/strong>, <strong>Month<\/strong> v\u00e0 <strong>Weekday<\/strong>.<\/li>\n\n\n<li>Trong ph\u1ea7n <strong>Command<\/strong>, nh\u1eadp l\u1ec7nh v\u1edbi \u0111\u01b0\u1eddng d\u1eabn \u0111\u1ea7y \u0111\u1ee7, v\u00ed d\u1ee5 <code>\/usr\/local\/bin\/php \/home\/user\/public_html\/cron.php<\/code>.<\/li>\n\n\n<li>Nh\u1ea5p v\u00e0o n\u00fat <strong>Add New Cron Job<\/strong> \u0111\u1ec3 l\u01b0u t\u00e1c v\u1ee5.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2024\/05\/cron-jobs-la-gi-7.png\" alt=\"Form Add New Cron Job trong cPanel: Common Settings, Minute 0, Hour 1, Day, Month, Weekday l\u00e0 d\u1ea5u sao, Command \/usr\/local\/bin\/backup.sh\" class=\"wp-image-95011\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2024\/05\/cron-jobs-la-gi-7.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2024\/05\/cron-jobs-la-gi-7-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><em>\u1ea2nh ch\u1ee5p giao di\u1ec7n cPanel b\u1ea3n c\u0169; \u1edf cPanel &#038; WHM 138 (b\u1ea3n hi\u1ec7n h\u00e0nh theo tier ch\u00ednh th\u1ee9c ng\u00e0y 25\/10\/2026) c\u00e1c \u00f4 v\u00e0 t\u00ean n\u00fat v\u1eabn gi\u1eef nh\u01b0 tr\u00ean.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>V\u00ed d\u1ee5:<\/strong> t\u1ea1o t\u00e1c v\u1ee5 sao l\u01b0u l\u00fac 1 gi\u1edd s\u00e1ng m\u1ed7i ng\u00e0y:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Common Settings: Once Per Day<\/li>\n\n\n<li>Minute: 0<\/li>\n\n\n<li>Hour: 1<\/li>\n\n\n<li>Day: *<\/li>\n\n\n<li>Month: *<\/li>\n\n\n<li>Weekday: *<\/li>\n\n\n<li>Command: <code>\/usr\/local\/bin\/backup.sh<\/code><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1024\" height=\"180\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2024\/05\/cron-jobs-la-gi-8-1024x180.png\" alt=\"B\u1ea3ng Current Cron Jobs trong cPanel hi\u1ec3n th\u1ecb t\u00e1c v\u1ee5 0 1 * * * ch\u1ea1y \/usr\/local\/bin\/backup.sh v\u1edbi n\u00fat Edit v\u00e0 Delete\" class=\"wp-image-95012\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2024\/05\/cron-jobs-la-gi-8-1024x180.png 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2024\/05\/cron-jobs-la-gi-8-300x53.png 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2024\/05\/cron-jobs-la-gi-8-768x135.png 768w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2024\/05\/cron-jobs-la-gi-8.png 1375w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u0110\u1ec3 ch\u1ec9nh s\u1eeda t\u00e1c v\u1ee5, nh\u1ea5p <strong>Edit<\/strong> b\u00ean c\u1ea1nh t\u00e1c v\u1ee5, s\u1eeda r\u1ed3i b\u1ea5m <strong>Edit Line<\/strong>. \u0110\u1ec3 x\u00f3a, nh\u1ea5p <strong>Delete<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ba l\u01b0u \u00fd theo t\u00e0i li\u1ec7u cPanel:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Script t\u1ef1 vi\u1ebft (<code>.sh<\/code>) c\u1ea7n quy\u1ec1n th\u1ef1c thi; n\u1ebfu kh\u00f4ng mu\u1ed1n \u0111\u1ed5i quy\u1ec1n, g\u1ecdi qua tr\u00ecnh th\u00f4ng d\u1ecbch: <code>\/bin\/bash \/home\/user\/backup.sh<\/code>.<\/li>\n\n\n<li>C\u1ea9n th\u1eadn v\u1edbi l\u1ec7nh <code>rm<\/code> trong cron: sai \u0111\u01b0\u1eddng d\u1eabn c\u00f3 th\u1ec3 xo\u00e1 d\u1eef li\u1ec7u trong th\u01b0 m\u1ee5c home.<\/li>\n\n\n<li>Kh\u00f4ng \u0111\u1eb7t l\u1ecbch d\u00e0y h\u01a1n th\u1eddi gian l\u1ec7nh ch\u1ea1y xong, n\u1ebfu kh\u00f4ng nhi\u1ec1u ti\u1ebfn tr\u00ecnh s\u1ebd ch\u1ed3ng l\u00ean nhau v\u00e0 l\u00e0m ch\u1eadm hosting.<\/li>\n<\/ul>\n\n\n\n<h3 id=\"Nh\u1eadn_email_ho\u1eb7c_t\u1eaft_email_c\u1ee7a_cron_trong_cPanel\">Nh\u1eadn email ho\u1eb7c t\u1eaft email c\u1ee7a cron trong cPanel<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u00d4 <strong>Cron Email<\/strong> \u1edf \u0111\u1ea7u trang Cron Jobs nh\u1eadn \u0111\u1ea7u ra c\u1ee7a m\u1ecdi t\u00e1c v\u1ee5. L\u1ec7nh ch\u1ea1y m\u1ed7i 5 ph\u00fat s\u1ebd g\u1eedi kho\u1ea3ng 288 email m\u1ed7i ng\u00e0y, v\u00ec v\u1eady n\u00ean ghi \u0111\u1ea7u ra v\u00e0o file log ho\u1eb7c b\u1ecf \u0111i:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Ghi \u0111\u1ea7u ra v\u00e0o file log (gi\u1eef l\u1ea1i \u0111\u1ec3 tra l\u1ed7i)\n\/usr\/local\/bin\/php \/home\/user\/public_html\/cron.php &gt;&gt; \/home\/user\/logs\/cron.log 2&gt;&amp;1\n\n# B\u1ecf to\u00e0n b\u1ed9 \u0111\u1ea7u ra, kh\u00f4ng g\u1eedi email\n\/usr\/local\/bin\/php \/home\/user\/public_html\/cron.php &gt;\/dev\/null 2&gt;&amp;1<\/code><\/pre>\n\n\n\n<h2 id=\"C\u00e1ch_t\u1ea1o_Cron_Jobs_tr\u00ean_hosting_DirectAdmin\">C\u00e1ch t\u1ea1o Cron Jobs tr\u00ean hosting DirectAdmin<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">DirectAdmin c\u0169ng c\u00f3 m\u1ee5c t\u1ea1o cron cho t\u1eebng t\u00e0i kho\u1ea3n, d\u00f9ng \u0111\u00fang 5 tr\u01b0\u1eddng th\u1eddi gian v\u00e0 m\u1ed9t \u00f4 l\u1ec7nh nh\u01b0 cPanel. \u1ede trang ch\u00ednh c\u1ee7a DirectAdmin, g\u00f5 \u201ccron\u201d v\u00e0o \u00f4 t\u00ecm ki\u1ebfm \u0111\u1ec3 m\u1edf m\u1ee5c <strong>Cronjobs<\/strong>, \u0111i\u1ec1n Minute, Hour, Day of Month, Month, Day of Week, nh\u1eadp l\u1ec7nh c\u00f3 \u0111\u01b0\u1eddng d\u1eabn \u0111\u1ea7y \u0111\u1ee7 r\u1ed3i b\u1ea5m t\u1ea1o.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>T\u00ean m\u1ee5c v\u00e0 v\u1ecb tr\u00ed n\u00fat c\u00f3 th\u1ec3 kh\u00e1c nhau gi\u1eefa c\u00e1c giao di\u1ec7n DirectAdmin. \u0110\u01b0\u1eddng d\u1eabn PHP CLI tr\u00ean DirectAdmin th\u01b0\u1eddng kh\u00e1c cPanel; h\u1ecfi nh\u00e0 cung c\u1ea5p ho\u1eb7c ch\u1ea1y <code>which php<\/code> qua SSH \u0111\u1ec3 l\u1ea5y \u0111\u00fang \u0111\u01b0\u1eddng d\u1eabn.<\/em><\/p>\n\n\n\n<h2 id=\"D\u00f9ng_cron_thay_WP-Cron_cho_WordPress\">D\u00f9ng cron thay WP-Cron cho WordPress<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">WP-Cron l\u00e0 b\u1ed9 h\u1eb9n gi\u1edd c\u1ee7a WordPress, ch\u1ec9 ch\u1ea1y khi c\u00f3 ng\u01b0\u1eddi m\u1edf trang. Website \u00edt kh\u00e1ch s\u1ebd \u0111\u0103ng b\u00e0i h\u1eb9n gi\u1edd, g\u1eedi email, ch\u1ea1y backup plugin b\u1ecb tr\u1ec5; ng\u01b0\u1ee3c l\u1ea1i, WordPress v\u1eabn ki\u1ec3m tra danh s\u00e1ch t\u00e1c v\u1ee5 \u1edf m\u1ecdi l\u01b0\u1ee3t t\u1ea3i trang, t\u1ed1n th\u00eam t\u00e0i nguy\u00ean m\u00e1y ch\u1ee7. T\u00e0i li\u1ec7u <a href=\"https:\/\/developer.wordpress.org\/plugins\/cron\/hooking-wp-cron-into-the-system-task-scheduler\/\" target=\"_blank\" rel=\"noopener nofollow\">WordPress Developer: Hooking WP-Cron into the system task scheduler<\/a> khuy\u00ean giao vi\u1ec7c n\u00e0y cho cron c\u1ee7a m\u00e1y ch\u1ee7 r\u1ed3i t\u1eaft WP-Cron trong wp-config.php.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1400\" height=\"750\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cron-jobs-la-gi-wp-cron-va-cron-that.webp\" alt=\"So s\u00e1nh WP-Cron m\u1eb7c \u0111\u1ecbnh ch\u1ea1y theo l\u01b0\u1ee3t xem trang v\u1edbi cron c\u1ee7a hosting ch\u1ea1y \u0111\u00fang gi\u1edd, k\u00e8m ba b\u01b0\u1edbc theo th\u1ee9 t\u1ef1: t\u1ea1o cron g\u1ecdi wp-cron.php, th\u00eam DISABLE_WP_CRON v\u00e0o wp-config.php, ki\u1ec3m tra Site Health\" class=\"wp-image-132182\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cron-jobs-la-gi-wp-cron-va-cron-that.webp 1400w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cron-jobs-la-gi-wp-cron-va-cron-that-300x161.webp 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cron-jobs-la-gi-wp-cron-va-cron-that-1024x549.webp 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2026\/10\/cron-jobs-la-gi-wp-cron-va-cron-that-768x411.webp 768w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">L\u00e0m theo \u0111\u00fang th\u1ee9 t\u1ef1:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>T\u1ea1o cron job m\u1ed7i 15 ph\u00fat trong cPanel, l\u1ec7nh: <code>wget -q -O - https:\/\/tenmien.vn\/wp-cron.php?doing_wp_cron &gt;\/dev\/null 2&gt;&amp;1<\/code>. N\u1ebfu hosting c\u00f3 PHP CLI, c\u00f3 th\u1ec3 d\u00f9ng <code>cd \/home\/user\/public_html &amp;&amp; \/usr\/local\/bin\/php wp-cron.php<\/code>.<\/li>\n\n\n<li>M\u1edf <a href=\"https:\/\/tino.vn\/blog\/wp-config-php-o-dau\/\">file wp-config.php<\/a>, th\u00eam d\u00f2ng <code>define( 'DISABLE_WP_CRON', true );<\/code> ph\u00eda tr\u00ean d\u00f2ng \u201cThat&#8217;s all, stop editing\u201d.<\/li>\n\n\n<li>Sau v\u00e0i gi\u1edd, v\u00e0o C\u00f4ng c\u1ee5 \u2192 T\u00ecnh tr\u1ea1ng trang (Site Health) xem c\u00f3 c\u1ea3nh b\u00e1o \u201cs\u1ef1 ki\u1ec7n \u0111\u00e3 l\u00ean l\u1ecbch b\u1ecb tr\u1ec5\u201d kh\u00f4ng.<\/li>\n<\/ol>\n\n\n\n<h2 id=\"Cron_job_kh\u00f4ng_ch\u1ea1y:_ki\u1ec3m_tra_nh\u1eefng_g\u00ec?\">Cron job kh\u00f4ng ch\u1ea1y: ki\u1ec3m tra nh\u1eefng g\u00ec?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Cron job kh\u00f4ng ch\u1ea1y th\u01b0\u1eddng do sai \u0111\u01b0\u1eddng d\u1eabn, thi\u1ebfu quy\u1ec1n ho\u1eb7c m\u00f4i tr\u01b0\u1eddng kh\u00e1c v\u1edbi khi b\u1ea1n ch\u1ea1y tay: cron ch\u1ea1y v\u1edbi bi\u1ebfn PATH r\u00fat g\u1ecdn, kh\u00f4ng \u0111\u1ecdc file c\u1ea5u h\u00ecnh shell c\u1ee7a b\u1ea1n v\u00e0 kh\u00f4ng bi\u1ebft th\u01b0 m\u1ee5c hi\u1ec7n t\u1ea1i. Ki\u1ec3m tra l\u1ea7n l\u01b0\u1ee3t c\u00e1c \u0111i\u1ec3m d\u01b0\u1edbi, d\u1eebng \u1edf \u0111i\u1ec3m \u0111\u1ea7u ti\u00ean sai:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u0110\u01b0\u1eddng d\u1eabn \u0111\u1ea7y \u0111\u1ee7:<\/strong> cron kh\u00f4ng bi\u1ebft th\u01b0 m\u1ee5c hi\u1ec7n t\u1ea1i c\u1ee7a b\u1ea1n; vi\u1ebft \u0111\u1ee7 <code>\/home\/user\/\u2026<\/code> v\u00e0 \u0111\u01b0\u1eddng d\u1eabn t\u1edbi <code>php<\/code>.<\/li>\n\n\n<li><strong>Phi\u00ean b\u1ea3n PHP:<\/strong> PHP CLI m\u1eb7c \u0111\u1ecbnh c\u00f3 th\u1ec3 kh\u00e1c phi\u00ean b\u1ea3n b\u1ea1n ch\u1ecdn cho website; g\u1ecdi \u0111\u00fang binary c\u1ee7a phi\u00ean b\u1ea3n c\u1ea7n d\u00f9ng.<\/li>\n\n\n<li><strong>Quy\u1ec1n th\u1ef1c thi:<\/strong> ch\u1ea1y <code>chmod +x<\/code> cho script ho\u1eb7c g\u1ecdi qua <code>\/bin\/bash<\/code>.<\/li>\n\n\n<li><strong>K\u00fd t\u1ef1 %:<\/strong> ph\u1ea3i vi\u1ebft <code>\\%<\/code>.<\/li>\n\n\n<li><strong>Xem log:<\/strong> t\u1ea1m th\u1eddi \u0111\u1ed5i <code>&gt;\/dev\/null<\/code> th\u00e0nh <code>&gt;&gt; ~\/cron.log 2&gt;&amp;1<\/code> \u0111\u1ec3 \u0111\u1ecdc l\u1ed7i th\u1eadt.<\/li>\n\n\n<li><strong>Th\u1eed ch\u1ea1y tay:<\/strong> ch\u1ea1y \u0111\u00fang l\u1ec7nh \u0111\u00f3 qua <a href=\"https:\/\/tino.vn\/blog\/ssh-tren-share-cloud-hosting-su-dung-terminal\/\">Terminal trong cPanel<\/a>; ch\u1ea1y tay l\u1ed7i th\u00ec cron c\u0169ng l\u1ed7i.<\/li>\n<\/ul>\n\n\n\n<h2 id=\"L\u1ee3i_\u00edch_v\u00e0_h\u1ea1n_ch\u1ebf_c\u1ee7a_Cron_Jobs\">L\u1ee3i \u00edch v\u00e0 h\u1ea1n ch\u1ebf c\u1ee7a Cron Jobs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">L\u1ee3i \u00edch l\u1edbn c\u1ee7a cron job l\u00e0 ch\u1ea1y \u0111\u00fang gi\u1edd m\u00e0 kh\u00f4ng c\u1ea7n ai truy c\u1eadp website, c\u00f3 s\u1eb5n tr\u00ean hosting Linux v\u00e0 kh\u00f4ng t\u1ed1n th\u00eam ph\u00ed. \u0110\u1ed5i l\u1ea1i, cron kh\u00f4ng ch\u1ea1y d\u00e0y h\u01a1n 1 ph\u00fat, kh\u00f4ng t\u1ef1 ch\u1ea1y b\u00f9 l\u1ea7n b\u1ecb l\u1ee1 v\u00e0 d\u1ec5 b\u1ecb k\u1ebb x\u1ea5u l\u1ee3i d\u1ee5ng khi t\u00e0i kho\u1ea3n hosting b\u1ecb chi\u1ebfm.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><\/th><th>N\u1ed9i dung<\/th><\/tr><\/thead><tbody><tr><td>L\u1ee3i \u00edch<\/td><td>C\u00f3 s\u1eb5n tr\u00ean hosting Linux d\u00f9ng cPanel ho\u1eb7c DirectAdmin, kh\u00f4ng t\u1ed1n ph\u00ed th\u00eam; ch\u1ea1y \u0111\u00fang gi\u1edd k\u1ec3 c\u1ea3 khi kh\u00f4ng ai truy c\u1eadp; c\u00fa ph\u00e1p g\u1ecdn, m\u1ed9t d\u00f2ng cho m\u1ed9t t\u00e1c v\u1ee5; d\u00f9ng \u0111\u01b0\u1ee3c v\u1edbi m\u1ecdi ng\u00f4n ng\u1eef c\u00f3 l\u1ec7nh ch\u1ea1y t\u1eeb d\u00f2ng l\u1ec7nh.<\/td><\/tr><tr><td>H\u1ea1n ch\u1ebf<\/td><td>Kh\u00f4ng ch\u1ea1y d\u00e0y h\u01a1n 1 l\u1ea7n m\u1ed7i ph\u00fat; kh\u00f4ng t\u1ef1 ch\u1ea1y b\u00f9 khi m\u00e1y t\u1eaft \u0111\u00fang gi\u1edd h\u1eb9n; kh\u00f4ng b\u00e1o l\u1ed7i r\u00f5 r\u00e0ng n\u1ebfu b\u1ea1n t\u1eaft email; t\u00e1c v\u1ee5 ch\u1ea1y l\u00e2u c\u00f3 th\u1ec3 ch\u1ed3ng l\u00ean l\u1ea7n ch\u1ea1y sau.<\/td><\/tr><tr><td>R\u1ee7i ro b\u1ea3o m\u1eadt<\/td><td>K\u1ebb chi\u1ebfm \u0111\u01b0\u1ee3c t\u00e0i kho\u1ea3n hosting th\u01b0\u1eddng c\u00e0i cron \u0111\u1ec3 ch\u1ea1y l\u1ea1i m\u00e3 \u0111\u1ed9c. \u0110\u1ecbnh k\u1ef3 m\u1edf m\u1ee5c Cron Jobs ki\u1ec3m tra c\u00f3 d\u00f2ng l\u1ea1 kh\u00f4ng, \u0111\u1eb7c bi\u1ec7t sau khi website b\u1ecb nhi\u1ec5m m\u00e3 \u0111\u1ed9c.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 id=\"Khi_n\u00e0o_kh\u00f4ng_n\u00ean_d\u00f9ng_cron_tr\u00ean_hosting?\">Khi n\u00e0o kh\u00f4ng n\u00ean d\u00f9ng cron tr\u00ean hosting?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Cron tr\u00ean shared hosting h\u1ee3p v\u1edbi t\u00e1c v\u1ee5 ng\u1eafn, ch\u1ea1y theo l\u1ecbch th\u01b0a. Ba tr\u01b0\u1eddng h\u1ee3p d\u01b0\u1edbi \u0111\u00e2y n\u00ean ch\u1ecdn c\u00e1ch kh\u00e1c, v\u00ec cron tr\u00ean hosting s\u1ebd ch\u1ea1y ch\u1eadp ch\u1eddn, b\u1ecb d\u1eebng gi\u1eefa ch\u1eebng ho\u1eb7c kh\u00f4ng c\u00f3 quy\u1ec1n d\u00f9ng:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>C\u1ea7n ch\u1ea1y d\u01b0\u1edbi 1 ph\u00fat ho\u1eb7c ch\u1ea1y li\u00ean t\u1ee5c (worker, websocket, bot): shared hosting kh\u00f4ng ph\u00f9 h\u1ee3p, h\u00e3y d\u00f9ng <a href=\"https:\/\/tino.vn\/blog\/vps-la-gi\/\">VPS<\/a> v\u1edbi systemd ho\u1eb7c supervisor (so s\u00e1nh \u1edf b\u00e0i <a href=\"https:\/\/tino.vn\/blog\/nen-lua-chon-shared-hosting-hay-vps-hosting\/\">n\u00ean ch\u1ecdn shared hosting hay VPS<\/a>).<\/li>\n\n\n<li>T\u00e1c v\u1ee5 n\u1eb7ng ch\u1ea1y h\u00e0ng ch\u1ee5c ph\u00fat (x\u1eed l\u00fd video, nh\u1eadp h\u00e0ng tr\u0103m ngh\u00ecn s\u1ea3n ph\u1ea9m): d\u1ec5 ch\u1ea1m gi\u1edbi h\u1ea1n CPU\/RAM c\u1ee7a g\u00f3i v\u00e0 b\u1ecb d\u1eebng gi\u1eefa ch\u1eebng.<\/li>\n\n\n<li>Ch\u1ec9 c\u1ea7n g\u1ecdi m\u1ed9t URL theo l\u1ecbch m\u00e0 kh\u00f4ng c\u00f3 quy\u1ec1n cron: c\u00f3 th\u1ec3 d\u00f9ng d\u1ecbch v\u1ee5 ngo\u00e0i nh\u01b0 <a href=\"https:\/\/cron-job.org\/en\/faq\/\" target=\"_blank\" rel=\"noopener nofollow\">cron-job.org<\/a>, nh\u01b0ng ph\u1ea3i b\u1ea3o v\u1ec7 URL \u0111\u00f3 b\u1eb1ng kho\u00e1 b\u00ed m\u1eadt.<\/li>\n<\/ul>\n\n\n\n<h2 id=\"K\u1ebft_lu\u1eadn\">K\u1ebft lu\u1eadn<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Cron job l\u00e0 c\u00e1ch \u0111\u01a1n gi\u1ea3n \u0111\u1ec3 hosting t\u1ef1 l\u00e0m vi\u1ec7c l\u1eb7p l\u1ea1i \u0111\u00fang gi\u1edd: backup, email, t\u00e1c v\u1ee5 c\u1ee7a WordPress hay Laravel. N\u1eafm 5 tr\u01b0\u1eddng th\u1eddi gian, lu\u00f4n d\u00f9ng \u0111\u01b0\u1eddng d\u1eabn \u0111\u1ea7y \u0111\u1ee7, ghi \u0111\u1ea7u ra v\u00e0o log v\u00e0 ki\u1ec3m tra \u0111\u1ecbnh k\u1ef3 danh s\u00e1ch cron l\u00e0 \u0111\u1ee7 cho h\u1ea7u h\u1ebft website. Khi c\u1ea7n l\u1ecbch d\u00e0y h\u01a1n 1 ph\u00fat ho\u1eb7c t\u00e1c v\u1ee5 ch\u1ea1y d\u00e0i, \u0111\u00f3 l\u00e0 d\u1ea5u hi\u1ec7u n\u00ean chuy\u1ec3n l\u00ean VPS.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">C\u1ea7n hosting \u1ed5n \u0111\u1ecbnh cho website? <a href=\"https:\/\/tino.vn\/hosting-gia-re\">Hosting c\u1ee7a Tino<\/a> d\u00f9ng \u1ed5 NVMe, LiteSpeed v\u00e0 cPanel \u0111\u1ec3 b\u1ea1n t\u1ef1 qu\u1ea3n tr\u1ecb. Xem c\u1ea5u h\u00ecnh v\u00e0 gi\u00e1 tr\u00ean trang s\u1ea3n ph\u1ea9m.<\/p>\n<\/blockquote>\n\n\n\n<h2 id=\"C\u00e2u_h\u1ecfi_th\u01b0\u1eddng_g\u1eb7p\">C\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p<\/h2>\n\n\n\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"cron-job.org_l\u00e0_g\u00ec?\">cron-job.org l\u00e0 g\u00ec?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">cron-job.org l\u00e0 d\u1ecbch v\u1ee5 mi\u1ec5n ph\u00ed (duy tr\u00ec b\u1eb1ng quy\u00ean g\u00f3p) g\u1ecdi m\u1ed9t URL theo l\u1ecbch b\u1ea1n \u0111\u1eb7t, h\u1ee3p v\u1edbi website kh\u00f4ng c\u00f3 quy\u1ec1n cron. Theo <a href=\"https:\/\/cron-job.org\/en\/faq\/\" target=\"_blank\" rel=\"noopener nofollow\">FAQ c\u1ee7a cron-job.org<\/a>, m\u1ed7i job ch\u1ea1y t\u1ed1i \u0111a 60 l\u1ea7n\/gi\u1edd v\u00e0 b\u1ecb ng\u1eaft n\u1ebfu URL kh\u00f4ng ph\u1ea3n h\u1ed3i sau 30 gi\u00e2y.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"C\u00f3_th\u1ec3_ch\u1ea1y_cron_job_theo_gi\u00e2y_kh\u00f4ng?\">C\u00f3 th\u1ec3 ch\u1ea1y cron job theo gi\u00e2y kh\u00f4ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">Kh\u00f4ng. \u0110\u01a1n v\u1ecb th\u1eddi gian t\u1ed1i thi\u1ec3u c\u1ee7a cron l\u00e0 1 ph\u00fat. N\u1ebfu c\u1ea7n ch\u1ea1y m\u1ed7i v\u00e0i gi\u00e2y, h\u00e3y vi\u1ebft m\u1ed9t ti\u1ebfn tr\u00ecnh ch\u1ea1y li\u00ean t\u1ee5c (v\u00f2ng l\u1eb7p c\u00f3 sleep) v\u00e0 qu\u1ea3n l\u00fd b\u1eb1ng systemd tr\u00ean VPS; tr\u00ean shared hosting c\u00e1ch n\u00e0y th\u01b0\u1eddng b\u1ecb ch\u1eb7n.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"Cron_job_ch\u1ea1y_theo_m\u00fai_gi\u1edd_n\u00e0o?\">Cron job ch\u1ea1y theo m\u00fai gi\u1edd n\u00e0o?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">Cron d\u00f9ng m\u00fai gi\u1edd c\u1ee7a m\u00e1y ch\u1ee7. N\u1ebfu m\u00e1y ch\u1ee7 kh\u00f4ng \u0111\u1eb7t gi\u1edd Vi\u1ec7t Nam, h\u00e3y quy \u0111\u1ed5i tr\u01b0\u1edbc khi nh\u1eadp l\u1ecbch, ho\u1eb7c ki\u1ec3m tra b\u1eb1ng l\u1ec7nh <code>date<\/code> trong Terminal.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"L\u00e0m_sao_bi\u1ebft_cron_job_\u0111\u00e3_ch\u1ea1y?\">L\u00e0m sao bi\u1ebft cron job \u0111\u00e3 ch\u1ea1y?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">Ghi th\u00eam th\u1eddi \u0111i\u1ec3m ch\u1ea1y v\u00e0o log, v\u00ed d\u1ee5 <code>\/usr\/local\/bin\/php \/home\/user\/public_html\/cron.php &amp;&amp; date &gt;&gt; \/home\/user\/logs\/cron-ok.log<\/code>: m\u1ed7i l\u1ea7n l\u1ec7nh ch\u1ea1y xong kh\u00f4ng l\u1ed7i, file log c\u00f3 th\u00eam m\u1ed9t d\u00f2ng ng\u00e0y gi\u1edd. Kh\u00f4ng th\u1ea5y d\u00f2ng m\u1edbi sau gi\u1edd h\u1eb9n ngh\u0129a l\u00e0 l\u1ec7nh kh\u00f4ng ch\u1ea1y ho\u1eb7c ch\u1ea1y l\u1ed7i.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"T\u1ea1o_cron_job_ch\u1ea1y_file_PHP_theo_\u0111\u00fang_phi\u00ean_b\u1ea3n_PHP_nh\u01b0_th\u1ebf_n\u00e0o?\">T\u1ea1o cron job ch\u1ea1y file PHP theo \u0111\u00fang phi\u00ean b\u1ea3n PHP nh\u01b0 th\u1ebf n\u00e0o?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p class=\"wp-block-paragraph\">G\u1ecdi th\u1eb3ng binary PHP CLI c\u1ee7a phi\u00ean b\u1ea3n c\u1ea7n d\u00f9ng thay v\u00ec l\u1ec7nh <code>php<\/code> chung. Tr\u00ean cPanel d\u00f9ng EasyApache 4, binary n\u1eb1m \u1edf d\u1ea1ng <code>\/opt\/cpanel\/ea-php83\/root\/usr\/bin\/php<\/code>; tr\u00ean m\u00e1y ch\u1ee7 CloudLinux c\u00f3 PHP Selector, d\u1ea1ng <code>\/opt\/alt\/php83\/usr\/bin\/php<\/code>. Ch\u1ea1y th\u1eed l\u1ec7nh v\u1edbi tham s\u1ed1 <code>-v<\/code> trong Terminal \u0111\u1ec3 ch\u1eafc \u0111\u01b0\u1eddng d\u1eabn t\u1ed3n t\u1ea1i tr\u01b0\u1edbc khi d\u00e1n v\u00e0o \u00f4 Command.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\n<script type=\"application\/ld+json\">\n\t{\n\t\t\"@context\": \"https:\/\/schema.org\",\n\t\t\"@type\": \"FAQPage\",\n\t\t\"mainEntity\": [\n\t\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"cron-job.org l\u00e0 g\u00ec?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>cron-job.org l\u00e0 d\u1ecbch v\u1ee5 mi\u1ec5n ph\u00ed (duy tr\u00ec b\u1eb1ng quy\u00ean g\u00f3p) g\u1ecdi m\u1ed9t URL theo l\u1ecbch b\u1ea1n \u0111\u1eb7t, h\u1ee3p v\u1edbi website kh\u00f4ng c\u00f3 quy\u1ec1n cron. Theo <a>FAQ c\u1ee7a cron-job.org<\/a>, m\u1ed7i job ch\u1ea1y t\u1ed1i \u0111a 60 l\u1ea7n\/gi\u1edd v\u00e0 b\u1ecb ng\u1eaft n\u1ebfu URL kh\u00f4ng ph\u1ea3n h\u1ed3i sau 30 gi\u00e2y.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"C\u00f3 th\u1ec3 ch\u1ea1y cron job theo gi\u00e2y kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Kh\u00f4ng. \u0110\u01a1n v\u1ecb th\u1eddi gian t\u1ed1i thi\u1ec3u c\u1ee7a cron l\u00e0 1 ph\u00fat. N\u1ebfu c\u1ea7n ch\u1ea1y m\u1ed7i v\u00e0i gi\u00e2y, h\u00e3y vi\u1ebft m\u1ed9t ti\u1ebfn tr\u00ecnh ch\u1ea1y li\u00ean t\u1ee5c (v\u00f2ng l\u1eb7p c\u00f3 sleep) v\u00e0 qu\u1ea3n l\u00fd b\u1eb1ng systemd tr\u00ean VPS; tr\u00ean shared hosting c\u00e1ch n\u00e0y th\u01b0\u1eddng b\u1ecb ch\u1eb7n.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"Cron job ch\u1ea1y theo m\u00fai gi\u1edd n\u00e0o?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Cron d\u00f9ng m\u00fai gi\u1edd c\u1ee7a m\u00e1y ch\u1ee7. N\u1ebfu m\u00e1y ch\u1ee7 kh\u00f4ng \u0111\u1eb7t gi\u1edd Vi\u1ec7t Nam, h\u00e3y quy \u0111\u1ed5i tr\u01b0\u1edbc khi nh\u1eadp l\u1ecbch, ho\u1eb7c ki\u1ec3m tra b\u1eb1ng l\u1ec7nh date trong Terminal.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"L\u00e0m sao bi\u1ebft cron job \u0111\u00e3 ch\u1ea1y?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Ghi th\u00eam th\u1eddi \u0111i\u1ec3m ch\u1ea1y v\u00e0o log, v\u00ed d\u1ee5 \/usr\/local\/bin\/php \/home\/user\/public_html\/cron.php &amp;&amp; date &gt;&gt; \/home\/user\/logs\/cron-ok.log: m\u1ed7i l\u1ea7n l\u1ec7nh ch\u1ea1y xong kh\u00f4ng l\u1ed7i, file log c\u00f3 th\u00eam m\u1ed9t d\u00f2ng ng\u00e0y gi\u1edd. Kh\u00f4ng th\u1ea5y d\u00f2ng m\u1edbi sau gi\u1edd h\u1eb9n ngh\u0129a l\u00e0 l\u1ec7nh kh\u00f4ng ch\u1ea1y ho\u1eb7c ch\u1ea1y l\u1ed7i.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"T\u1ea1o cron job ch\u1ea1y file PHP theo \u0111\u00fang phi\u00ean b\u1ea3n PHP nh\u01b0 th\u1ebf n\u00e0o?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>G\u1ecdi th\u1eb3ng binary PHP CLI c\u1ee7a phi\u00ean b\u1ea3n c\u1ea7n d\u00f9ng thay v\u00ec l\u1ec7nh php chung. Tr\u00ean cPanel d\u00f9ng EasyApache 4, binary n\u1eb1m \u1edf d\u1ea1ng \/opt\/cpanel\/ea-php83\/root\/usr\/bin\/php; tr\u00ean m\u00e1y ch\u1ee7 CloudLinux c\u00f3 PHP Selector, d\u1ea1ng \/opt\/alt\/php83\/usr\/bin\/php. Ch\u1ea1y th\u1eed l\u1ec7nh v\u1edbi tham s\u1ed1 -v trong Terminal \u0111\u1ec3 ch\u1eafc \u0111\u01b0\u1eddng d\u1eabn t\u1ed3n t\u1ea1i tr\u01b0\u1edbc khi d\u00e1n v\u00e0o \u00f4 Command.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t\t\t\t]\n\t}\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>Cron job l\u00e0 m\u1ed9t l\u1ec7nh ho\u1eb7c script \u0111\u01b0\u1ee3c h\u1eb9n gi\u1edd \u0111\u1ec3 m\u00e1y ch\u1ee7 Linux t\u1ef1 ch\u1ea1y l\u1eb7p l\u1ea1i theo l\u1ecbch, v\u00ed d\u1ee5 m\u1ed7i 15 ph\u00fat, 2 gi\u1edd s\u00e1ng m\u1ed7i ng\u00e0y hay ng\u00e0y 1 h\u1eb1ng th\u00e1ng. Ch\u01b0\u01a1ng tr\u00ecnh ch\u1ea1y n\u1ec1n cron \u0111\u1ecdc l\u1ecbch, \u0111\u1ebfn \u0111\u00fang ph\u00fat th\u00ec th\u1ef1c thi l\u1ec7nh, kh\u00f4ng c\u1ea7n ai m\u1edf m\u00e1y hay [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":132126,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7726],"tags":[6394],"class_list":["post-581","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hosting","tag-kien-thuc-hosting"],"_links":{"self":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/comments?post=581"}],"version-history":[{"count":2,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/581\/revisions"}],"predecessor-version":[{"id":132273,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/581\/revisions\/132273"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media\/132126"}],"wp:attachment":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media?parent=581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/categories?post=581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/tags?post=581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}