{"id":637,"date":"2021-07-23T12:34:31","date_gmt":"2021-07-23T12:34:31","guid":{"rendered":"https:\/\/ssdsunucum.com\/blog\/guide-to-git-how-to-set-up-deployment-cron-jobs\/"},"modified":"2021-07-23T12:34:31","modified_gmt":"2021-07-23T12:34:31","slug":"guide-to-git-how-to-set-up-deployment-cron-jobs","status":"publish","type":"post","link":"https:\/\/ssdsunucum.com\/blog\/guide-to-git-how-to-set-up-deployment-cron-jobs\/","title":{"rendered":"Guide to Git\u2122 &#8211; How to Set Up Deployment Cron Jobs"},"content":{"rendered":"<\/p>\n<div class=\"col-md-9\">\n<div class=\"flex-column flex-md-row article-header\"><\/div>\n<hr>\n<h2 id=\"overview\">Overview<\/h2>\n<p>If you wish to deploy the contents of a cPanel-managed repository on a schedule, you can set up deployment cron jobs. Cron jobs allow you to configure the system to run a specified command automatically at a specified interval.<\/p>\n<p>For more information about deployment, read our Guide to Git &#8211; Deployment documentation.<\/p>\n<h2 id=\"find-the-repository-path\">Find the repository path<\/h2>\n<p>In order to configure your deployment cron job, you <strong>must<\/strong> use the correct repository path.<\/p>\n<p>To locate the desired repository\u2019s directory, navigate to cPanel\u2019s <em>Git Version Control<\/em> interface (<em>cPanel &gt;&gt; Home &gt;&gt; Files &gt;&gt; Git Version Control<\/em>). Then, in the list of repositories, locate the <em>Repository Path<\/em> value for the desired repository.<\/p>\n<h2 id=\"configure-your-cron-job\">Configure your cron job<\/h2>\n<p>The <em>Cron Jobs<\/em> interface (<em>cPanel &gt;&gt; Home &gt;&gt; Advanced &gt;&gt; Cron Jobs<\/em>) allows you to configure cron jobs.<\/p>\n<p>To configure your deployment cron job, perform the following steps:<\/p>\n<ol>\n<li>\n<p>Select the interval at which you wish to run the cron job. You can select a commonly-used interval from the <em>Common Settings<\/em> menu, or select or enter a specific interval for the following values:<\/p>\n<ul>\n<li><em>Minute<\/em> \u2014 The number of minutes between each time that the cron job runs or the minute of each hour on which you wish to run the cron job.<\/li>\n<li><em>Hour<\/em> \u2014 The number of hours between each time that the cron job runs or the hour of each day on which you wish to run the cron job.<\/li>\n<li><em>Day<\/em> \u2014 The number of days between each time that the cron job runs or the day of the month on which you wish to run the cron job.<\/li>\n<li><em>Month<\/em> \u2014 The number of months between each time that the cron job runs or the month in which you wish to run the cron job.<\/li>\n<li><em>Weekday<\/em> \u2014 The days of the week on which you wish to run the cron job.<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>In the <em>Command<\/em> text box, enter the commands that you wish the system to run. For example:\n<\/p>\n<div class=\"highlight\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-perl\" data-lang=\"perl\"><span style=\"color:#e6db74\">\/usr\/<\/span>bin<span style=\"color:#e6db74\">\/uapi VersionControlDeployment create repository_root=\/<\/span>home<span style=\"color:#e6db74\">\/user\/<\/span>example\n<\/code><\/pre>\n<\/div>\n<div class=\"callout callout-info\">\n<div class=\"callout-heading\">Note:<\/div>\n<div class=\"callout-content\">\n<ul>\n<li>\n<p>In this example, <code>\/home\/user\/example<\/code> represents the repository\u2019s <em>Repository Path<\/em> value.<\/p>\n<\/li>\n<li>\n<p>If your server runs CloudLinux\u2122, begin these commands with the <code>\/usr\/local\/cpanel\/bin\/<\/code> filepath. For example:\n<\/p>\n<div class=\"highlight\">\n<pre style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4\"><code class=\"language-perl\" data-lang=\"perl\"><span style=\"color:#e6db74\">\/usr\/<\/span>local<span style=\"color:#e6db74\">\/cpanel\/<\/span>bin<span style=\"color:#e6db74\">\/uapi VersionControlDeployment create repository_root=\/<\/span>home<span style=\"color:#e6db74\">\/user\/<\/span>example<\/code><\/pre>\n<\/div>\n<p>This command calls UAPI\u2019s <code>VersionControlDeployment::create<\/code> function, which creates a new deployment task. This task will run the deployment commands that you specified in your <code>.cpanel.yml<\/code> file once.<\/li>\n<\/ul><\/div>\n<\/div>\n<\/li>\n<li>\n<p>Click <em>Add New Cron Job<\/em>.<\/p>\n<\/li>\n<\/ol><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Overview If you wish to deploy the contents of a cPanel-managed repository on a schedule, you can set up deployment cron jobs. Cron jobs allow you to configure the system to run a specified command automatically at a specified interval. For more information about deployment, read our Guide to Git &#8211; Deployment documentation. Find the &hellip;<\/p>\n","protected":false},"author":1,"featured_media":638,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/637"}],"collection":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/comments?post=637"}],"version-history":[{"count":0,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/posts\/637\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media\/638"}],"wp:attachment":[{"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/media?parent=637"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/categories?post=637"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ssdsunucum.com\/blog\/wp-json\/wp\/v2\/tags?post=637"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}