Answers.Body: <p>Of course you can, but it's going to be a little bit tricky since you have to be logged in or you have to find a way how to login with an automatic request.
  Like others said, it's a dangerous things and I would not suggest to auto update since something can eventually break and you'll not notice it before your customers.</p>
  
  <p>What you can do is</p>
  
  <ol>
  <li>Create a controller that uses the <code>user</code> service to login with admin credentials</li>
  <li>Redirect to <code>admin/updates/go/craft</code> &lt;- this will start the update</li>
  </ol>
  
  <p>Making an update for Craft 2 is actually just visiting the <code>admin/updates/go/craft</code> everything else is automatic</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-12T17:03:43.267Z
Answers.Text: I agree with you both that it's bad practice. I want to experiment with this within a staging environment :)
Answers.UserDisplayName: Sam
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-12T17:12:54.267Z
Answers.Text: Alright, if it's only for staging servers it might be ok. If you are not able to create an auto login I can provide one. I'm currently on my smartphone so it's a little bit tricky to write code but it requires actually all in all only about 10-15 lines because craft has many ready to use functions for that
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-12T16:24:08.807Z
Answers.LastActivityDate: 2018-01-12T16:24:08.807Z
Answers.UserDisplayName: Robin Schambach
Answers.Body: <p>It's typically bad practice to allow auto-updates -- at least in a production environment.</p>
  
  <p>That being said, to update Craft, you're required to download the new files (click "Download" on the update page and it gives you a zip file), and then replace them in your codebase. So right now, no you wouldn't be able to do this with a Cron Job.</p>
  
  <p>Craft 3 may be a different story, though.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-12T16:06:50.590Z
Answers.LastActivityDate: 2018-01-12T16:06:50.590Z
Answers.UserDisplayName: Scott Stubblefield
Body: <p>Is it possible to automatically apply Craft CMS updates when they become available? </p>
  
  <p>At the moment, I have to go into the CPanel and apply updates with the one-click option.</p>
  
  <p>Maybe I can do this with a cron job?</p>
  
Tags: <updates><auto-updates>
Title: Apply updates automatically when available
ThreadText: # Apply updates automatically when available
  
  (Asked by: username_0 on 2018-01-12)
  
  Is it possible to automatically apply Craft CMS updates when they become available?
  
  At the moment, I have to go into the CPanel and apply updates with the one-click option.
  
  Maybe I can do this with a cron job?
  
  **Tags:** updates, auto-updates
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-01-12. Score: 2 | Accepted answer
  
  Of course you can, but it's going to be a little bit tricky since you have to be logged in or you have to find a way how to login with an automatic request.
  Like others said, it's a dangerous things and I would not suggest to auto update since something can eventually break and you'll not notice it before your customers.
  
  What you can do is
  
  1. Create a controller that uses the `user` service to login with admin credentials
  2. Redirect to `admin/updates/go/craft` <- this will start the update
  
  Making an update for Craft 2 is actually just visiting the `admin/updates/go/craft` everything else is automatic
  
  > **Comments:**
  > **username_0**: I agree with you both that it's bad practice. I want to experiment with this within a staging environment :)  
  > **username_1**: Alright, if it's only for staging servers it might be ok. If you are not able to create an auto login I can provide one. I'm currently on my smartphone so it's a little bit tricky to write code but it requires actually all in all only about 10-15 lines because craft has many ready to use functions for that  
  
  ---
  
  ### Answer by username_2 on 2018-01-12. Score: 2
  
  It's typically bad practice to allow auto-updates -- at least in a production environment.
  
  That being said, to update Craft, you're required to download the new files (click "Download" on the update page and it gives you a zip file), and then replace them in your codebase. So right now, no you wouldn't be able to do this with a Cron Job.
  
  Craft 3 may be a different story, though.
  
  
  ---
  
  