[doc] ./gitea dump doesn't allows to specify backup destination #1025

Closed
opened 2025-11-02 03:45:41 -06:00 by GiteaMirror · 19 comments
Owner

Originally created by @vizcay on GitHub (Aug 30, 2017).

I like gitea dump because it allows to backup everything into a single file, but I find it difficult to automate (weekly cron job) because it's doesn't allows to specify the exact destination of the backup (to copy it elsewhere for example).

That leaves us with the (not pretty) option to parse the output to get the zip name.. something like gitea dump --destination /path/to/zip would be great.

Sorry not a go developer, if not I will simply send a PR for this (yeps it's a lame excuse, I know =)

Originally created by @vizcay on GitHub (Aug 30, 2017). I like ```gitea dump``` because it allows to backup everything into a single file, but I find it difficult to automate (weekly cron job) because it's doesn't allows to specify the exact destination of the backup (to copy it elsewhere for example). That leaves us with the (not pretty) option to parse the output to get the zip name.. something like ```gitea dump --destination /path/to/zip``` would be great. Sorry not a go developer, if not I will simply send a PR for this (yeps it's a lame excuse, I know =)
GiteaMirror added the issue/confirmedtype/docs labels 2025-11-02 03:45:41 -06:00
Author
Owner

@vizcay commented on GitHub (Aug 31, 2017):

./gitea dump 2>&1 >/dev/null | awk 'END {print $NF}'
(just in case somebody wonders how to get it)

@vizcay commented on GitHub (Aug 31, 2017): ```./gitea dump 2>&1 >/dev/null | awk 'END {print $NF}'``` (just in case somebody wonders how to get it)
Author
Owner

@lafriks commented on GitHub (Aug 31, 2017):

I think WIP PR #1637 will implement this?

@lafriks commented on GitHub (Aug 31, 2017): I think WIP PR #1637 will implement this?
Author
Owner

@vizcay commented on GitHub (Aug 31, 2017):

@lafriks Not exactly:

   --config FILE, -c FILE   Custom configuration FILE path (default: "custom/conf/app.ini")
   --tempdir PATH, -t PATH  Temporary directory PATH (default: "/tmp")
   --target PATH            Target directory PATH to save backup archive (default: "./")
   --verbose, -v            Show process details
   --db                     Backup the database (default: true)
   --repos                  Backup repositories (default: true)
   --data                   Backup attachments and avatars (default: true)
   --custom                 Backup custom files (default: true)

--target will allow to specify where to land the zip, but still no luck to set the filename.

@vizcay commented on GitHub (Aug 31, 2017): @lafriks Not exactly: ```OPTIONS: --config FILE, -c FILE Custom configuration FILE path (default: "custom/conf/app.ini") --tempdir PATH, -t PATH Temporary directory PATH (default: "/tmp") --target PATH Target directory PATH to save backup archive (default: "./") --verbose, -v Show process details --db Backup the database (default: true) --repos Backup repositories (default: true) --data Backup attachments and avatars (default: true) --custom Backup custom files (default: true) ``` **--target** will allow to specify where to land the zip, but still no luck to set the filename.
Author
Owner

@bkcsoft commented on GitHub (Sep 4, 2017):

Should be easy enough to change --target to take a filename instead of a directory :)

@bkcsoft commented on GitHub (Sep 4, 2017): Should be easy enough to change `--target` to take a filename instead of a directory :)
Author
Owner

@jabouchleih commented on GitHub (Feb 13, 2018):

Was this functionality removed?

OPTIONS:
--config value, -c value Custom configuration file path (default: "custom/conf/app.ini")
--verbose, -v Show process details
--tempdir value, -t value Temporary dir path (default: "/tmp")
--database value, -d value Specify the database SQL syntax

@jabouchleih commented on GitHub (Feb 13, 2018): Was this functionality removed? > OPTIONS: > --config value, -c value Custom configuration file path (default: "custom/conf/app.ini") > --verbose, -v Show process details > --tempdir value, -t value Temporary dir path (default: "/tmp") > --database value, -d value Specify the database SQL syntax
Author
Owner

@vizcay commented on GitHub (Feb 14, 2018):

@Quinity to be honest IDK, I ended using awk to extract the dump filename but a --target or something similar will be much more appreciated.

@vizcay commented on GitHub (Feb 14, 2018): @Quinity to be honest IDK, I ended using awk to extract the dump filename but a --target or something similar will be much more appreciated.
Author
Owner

@The-King-of-Toasters commented on GitHub (Jun 21, 2018):

I recently tried tackling this using cron on my debian machine, but I had no luck. However, I found great sucess using a systemd service/timer and setting the WorkingDirectory to wherever you like.

The service file:

[Unit]
Description=Gitea Dump

[Service]
Type=simple
User=git
Group=git
WorkingDirectory=/var/gitea/backup
ExecStart=/usr/local/bin/gitea dump -c /etc/gitea/app.ini
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea

[Install]
WantedBy=multi-user.target

Timer:

[Unit]
Description=Daily Gitea Dump

[Timer]
# See systemd.time(7) for time format
OnCalendar=*-*-* 05:00:00
Persistent=true

[Install]
WantedBy=timers.target

And the output of /var/gitea/backup:

$ ls /var/gitea/backup
gitea-dump-1529562686.zip
@The-King-of-Toasters commented on GitHub (Jun 21, 2018): I recently tried tackling this using cron on my debian machine, but I had no luck. However, I found great sucess using a systemd service/timer and setting the `WorkingDirectory` to wherever you like. The service file: ```ini [Unit] Description=Gitea Dump [Service] Type=simple User=git Group=git WorkingDirectory=/var/gitea/backup ExecStart=/usr/local/bin/gitea dump -c /etc/gitea/app.ini Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea [Install] WantedBy=multi-user.target ``` Timer: ```ini [Unit] Description=Daily Gitea Dump [Timer] # See systemd.time(7) for time format OnCalendar=*-*-* 05:00:00 Persistent=true [Install] WantedBy=timers.target ``` And the output of `/var/gitea/backup`: ```sh $ ls /var/gitea/backup gitea-dump-1529562686.zip ```
Author
Owner

@stale[bot] commented on GitHub (Jan 22, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jan 22, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@nodiscc commented on GitHub (Nov 20, 2019):

--target is not documented in https://docs.gitea.io/en-us/backup-and-restore/

@nodiscc commented on GitHub (Nov 20, 2019): `--target` is not documented in https://docs.gitea.io/en-us/backup-and-restore/
Author
Owner

@lunny commented on GitHub (Nov 21, 2019):

So this is a documentation problem not a feature.

@lunny commented on GitHub (Nov 21, 2019): So this is a documentation problem not a feature.
Author
Owner

@AllTaken commented on GitHub (Nov 21, 2019):

I don't know. Does --target allow you to specify the filename now? That was the original feature request as I understand it. At least that's what I would want for my use-case.

@AllTaken commented on GitHub (Nov 21, 2019): I don't know. Does --target allow you to specify the filename now? That was the original feature request as I understand it. At least that's what I would want for my use-case.
Author
Owner

@nodiscc commented on GitHub (Nov 26, 2019):

@lunny I was just mentioning the missing documentation, in addition to the feature request discussed here - I think it's a good opportunity to fix the documentation. I don't think --target accepts a destination filename (only a directory).

I would appreciate this change, because I run dumps from a cron job and the destination directory ends up cluttered with daily dumps.

But maybe some people prefer the old behavior - in this case there could be 2 separate options (--destdir --destfile), or we could just resort to --destfile /var/backups/gitea/gitea-dump-$(date +%s)

@nodiscc commented on GitHub (Nov 26, 2019): @lunny I was just mentioning the missing documentation, in addition to the feature request discussed here - I think it's a good opportunity to fix the documentation. I don't think `--target` accepts a destination filename (only a directory). I would appreciate this change, because I run dumps from a cron job and the destination directory ends up cluttered with daily dumps. But maybe some people prefer the old behavior - in this case there could be 2 separate options (`--destdir` `--destfile`), or we could just resort to `--destfile /var/backups/gitea/gitea-dump-$(date +%s)`
Author
Owner

@AllTaken commented on GitHub (Jan 23, 2020):

So it looks like this has been implemented with:
--file name, -f name: Name of the dump file with will be created. Optional. (default: gitea-dump-[timestamp].zip).

I guess you can close this issue?
And to anyone else using the AWK trick from above: that doesn't work anymore.

@AllTaken commented on GitHub (Jan 23, 2020): So it looks like this has been implemented with: --file name, -f name: Name of the dump file with will be created. Optional. (default: gitea-dump-[timestamp].zip). I guess you can close this issue? And to anyone else using the AWK trick from above: that doesn't work anymore.
Author
Owner

@julian-poidevin commented on GitHub (May 19, 2020):

--target is not documented in https://docs.gitea.io/en-us/backup-and-restore/

This is not yet documented

@julian-poidevin commented on GitHub (May 19, 2020): > `--target` is not documented in https://docs.gitea.io/en-us/backup-and-restore/ This is not yet documented
Author
Owner

@nodiscc commented on GitHub (Jun 1, 2020):

--work-dir is also not documented (https://github.com/go-gitea/gitea/issues/9100)

@nodiscc commented on GitHub (Jun 1, 2020): `--work-dir` is also not documented (https://github.com/go-gitea/gitea/issues/9100)
Author
Owner

@6543 commented on GitHub (Sep 7, 2020):

it's implemented option: --file/-f

@6543 commented on GitHub (Sep 7, 2020): it's implemented option: `--file/-f`
Author
Owner

@6543 commented on GitHub (Sep 7, 2020):

and if you type gitea dump --help you get the whole documentation of this subcomand

@6543 commented on GitHub (Sep 7, 2020): and if you type `gitea dump --help` you get the whole documentation of this subcomand
Author
Owner

@nodiscc commented on GitHub (Sep 12, 2020):

@6543 yes but the documentation is wrong https://docs.gitea.io/en-us/command-line/#dump

Just copy pasting the gitea dump --help output there would be better than having outdated documentation. Do you want me to send a pull request?

@nodiscc commented on GitHub (Sep 12, 2020): @6543 yes but the documentation is wrong https://docs.gitea.io/en-us/command-line/#dump Just copy pasting the `gitea dump --help` output there would be better than having outdated documentation. Do you want me to send a pull request?
Author
Owner

@6543 commented on GitHub (Sep 12, 2020):

@nodiscc yes would be great!!!

files are in https://github.com/go-gitea/gitea/tree/master/docs

@6543 commented on GitHub (Sep 12, 2020): @nodiscc yes would be great!!! files are in https://github.com/go-gitea/gitea/tree/master/docs
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1025