{"id":9451,"date":"2026-06-02T18:40:56","date_gmt":"2026-06-02T16:40:56","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=9451"},"modified":"2026-06-02T18:40:57","modified_gmt":"2026-06-02T16:40:57","slug":"how-to-add-a-recurring-cron-job-to-terminate-specific-processes","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-add-a-recurring-cron-job-to-terminate-specific-processes\/","title":{"rendered":"How to Add a Recurring CRON Job to Terminate Specific Processes"},"content":{"rendered":"\n<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">If a website script generates excessive server load or contains inefficient code, you can temporarily mitigate the issue by creating a CRON job that automatically terminates a specific process at regular intervals. This should only be used as a temporary workaround while the root cause is being investigated and fixed.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-add-a-recurring-cron-job-to-terminate-specific-processes\/#Create_the_Script\" >Create the Script<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-add-a-recurring-cron-job-to-terminate-specific-processes\/#How_the_Script_Works\" >How the Script Works<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-to-add-a-recurring-cron-job-to-terminate-specific-processes\/#Add_the_CRON_Job\" >Add the CRON Job<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Create_the_Script\"><\/span>Create the Script<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First, connect to your hosting account via SSH.<\/p>\n\n\n\n<\/div>\n\n<div id=\"mybox-2683051749\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Early access<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Still need help?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contact our customer service team.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Message us<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">Create a new script file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>touch process-admin-ajax.sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Open the file for editing using your preferred text editor:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mcedit process-admin-ajax.sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following content:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\npkill -f admin-ajax.php\necho done<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save the file and exit the editor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Make the script executable:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 755 process-admin-ajax.sh<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_the_Script_Works\"><\/span>How the Script Works<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>pkill -f admin-ajax.php<\/code> searches for running processes containing <code>admin-ajax.php<\/code> in their command line and terminates them.<\/li>\n\n\n\n<li><code>echo done<\/code> outputs a confirmation message when the script runs.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Add_the_CRON_Job\"><\/span>Add the CRON Job<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Log in to the hosting control panel.<\/li>\n\n\n\n<li>Navigate to <strong>Additional Services<\/strong> \u2192 <strong>CRON Jobs<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Add<\/strong> to create a new scheduled task.<\/li>\n\n\n\n<li>Select <strong>BASH<\/strong> as the task type.<\/li>\n\n\n\n<li>Enter the full path to the script you created.<\/li>\n\n\n\n<li>Configure the execution interval according to your requirements.<\/li>\n\n\n\n<li>Click <strong>Add Task<\/strong> to save the configuration.<\/li>\n<\/ol>\n\n\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"725\" height=\"843\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/06\/image-41.png\" alt=\"\" class=\"wp-image-9453\" srcset=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/06\/image-41.png 725w, https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/06\/image-41-258x300.png 258w, https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/06\/image-41-10x12.png 10w\" sizes=\"auto, (max-width: 725px) 100vw, 725px\" \/><\/figure>\n<\/div>\n\n<div class=\"translation-block translation-block-merged\">\n\n\n<div class=\"wp-block-onethird-callout-box onethird-callout-wrap\"><div class=\"onethird-callout onethird-callout--hint\" style=\"--ot-bg:#EAFFF7;--ot-border:#C8E8D8;--ot-text:#6F7C88;--ot-title:#384048;--ot-body:#6F7C88;--ot-icon:#384048;border-radius:6px;padding:16px\"><div class=\"onethird-callout__head\"><span class=\"onethird-callout__icon\"><svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" aria-hidden=\"true\" focusable=\"false\"><circle fill=\"none\" stroke=\"#384048\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" cx=\"12\" cy=\"12\" r=\"9\"><\/circle><path fill=\"none\" stroke=\"#384048\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 10v6\"><\/path><path fill=\"none\" stroke=\"#384048\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 7h.01\"><\/path><\/svg><\/span><div class=\"onethird-callout__title\">Important notes<\/div><\/div><div class=\"onethird-callout__body\">Automatically terminating processes can interrupt website functionality and should only be used for troubleshooting or temporary load reduction.<br>Investigate the root cause of the excessive resource usage and correct the underlying code whenever possible.<br>Test the script carefully before scheduling it to run automatically in a production environment.<\/div><\/div><div class=\"onethird-callout__separator\" style=\"height:18px\" aria-hidden=\"true\"><\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[13],"manual_kb_tag":[402,2823,4277,4279,4280,5427,5428,5429,5430,5431],"class_list":["post-9451","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-cron","manual_kb_tag-server-load","manual_kb_tag-admin-ajax","manual_kb_tag-cron-job","manual_kb_tag-bash-script","manual_kb_tag-shell-script","manual_kb_tag-scheduled-task","manual_kb_tag-process-killer","manual_kb_tag-process-termination","manual_kb_tag-process-management","manual_kb_tag-kill-process"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/9451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/9451\/revisions"}],"predecessor-version":[{"id":9454,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/9451\/revisions\/9454"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/media?parent=9451"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manualknowledgebasecat?post=9451"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb_tag?post=9451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}