# How to restore backup tar.gz file from console command?

**URL:** https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940
**Category:** Support
**Created:** [2016 年 5 月 28 日午前 10:54 UTC](https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940 "2016-05-28T10:54:12Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![doudou](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@doudou](https://meta.discourse.org/u/doudou)
#### Post date: [2016 年 5 月 28 日午前 10:54 UTC](https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940/1 "2016-05-28T10:54:12Z")

</div>

How to restore backup tar.gz file from console command?

---

<div class="post-metadata">

### Author: ![Chopper](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chopper/32/57073_2.png) [@Chopper](https://meta.discourse.org/u/Chopper)
#### Post date: [2016 年 5 月 28 日午前 11:13 UTC](https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940/2 "2016-05-28T11:13:24Z")

</div>

You can find your answer

> [@Is there any way to restore your site from backup in the terminal?](https://meta.discourse.org/t/is-there-any-way-to-restore-your-site-from-backup-in-the-terminal/42377/2):
>
> Yes. They’re stored in public/backups/default/. Just run the following command (in the discourse directory) script/discourse restore \<filename.of.the.backup.tar.gz\>

Full command line :

`cd /var/discourse`  
`./launcher enter app`  
`discourse restore <filename.of.the.backup.tar.gz>`

---

<div class="post-metadata">

### Author: ![Vu\_Hoang](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vu_hoang/32/73286_2.png) [@Vu\_Hoang](https://meta.discourse.org/u/Vu_Hoang)
#### Post date: [2017 年 12 月 23 日午前 3:48 UTC](https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940/3 "2017-12-23T03:48:34Z")

</div>

hi guys,

i had the error like this:

```
> /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- thor (LoadError)
> 
> from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'

    from script/discourse:3:in `&lt;main&gt;'

```

any idea for this?  
Thanks!

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [2018 年 1 月 6 日午前 1:05 UTC](https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940/4 "2018-01-06T01:05:58Z")

</div>

I just tried restoring from console and had experienced the same issue.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2018 年 1 月 6 日午前 1:09 UTC](https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940/5 "2018-01-06T01:09:16Z")

</div>

Is this still working @techapj can we verify?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018 年 1 月 6 日午後 10:41 UTC](https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940/7 "2018-01-06T22:41:23Z")

</div>

> [@Vu\_Hoang](#):
>
> cannot load such file – thor

Can you confirm you saw this exact text? What command did you run?

Also … I think the command is `discourse` not `script/discourse`

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2018 年 1 月 6 日午後 11:49 UTC](https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940/8 "2018-01-06T23:49:50Z")

</div>

I can confirm that from inside a production container you want to run `discourse restore`, not script/discourse.

Also, you can run it without the filename and it’ll suggest the available files, which makes it easy to copy and paste the filename.

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [2018 年 1 月 7 日午前 1:45 UTC](https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940/9 "2018-01-07T01:45:52Z")

</div>

> [@sam](#):
>
> Can you confirm you saw this exact text? What command did you run?

Unfortunately, all sessions closed, and backup restored from UI, can’t tell for sure now.

The only thing I remember is there was a ‘cannot load such file’ string.

I was definitely trying `script/discourse`, so that might be the issue.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [2018 年 1 月 8 日午前 4:53 UTC](https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940/10 "2018-01-08T04:53:31Z")

</div>

I just ran the restore successfully on my sandbox using these commands:

```plaintext
cd /var/discourse
./launcher enter app
discourse enable_restore
discourse restore discourse-2018-01-08-044921-v20171228122834.tar.gz

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2020 年 3 月 21 日午後 2:44 UTC](https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940/11 "2020-03-21T14:44:52Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2020 年 4 月 20 日午後 2:44 UTC](https://meta.discourse.org/t/how-to-restore-backup-tar-gz-file-from-console-command/44940/12 "2020-04-20T14:44:52Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
