forked from TrueCloudLab/restic
return exit code 11 if the repository could not be locked
This commit is contained in:
parent
3b7228c8c1
commit
d76a78aa99
29 changed files with 30 additions and 0 deletions
|
@ -41,6 +41,7 @@ EXIT STATUS
|
|||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was a fatal error (no snapshot created).
|
||||
Exit status is 3 if some source data could not be read (incomplete snapshot created).
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
PreRun: func(_ *cobra.Command, _ []string) {
|
||||
if backupOptions.Host == "" {
|
||||
|
|
|
@ -23,6 +23,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -37,6 +37,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -36,6 +36,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return runCopy(cmd.Context(), copyOptions, globalOptions, args)
|
||||
|
|
|
@ -45,6 +45,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -41,6 +41,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -36,6 +36,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -35,6 +35,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -37,6 +37,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -21,6 +21,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -21,6 +21,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -21,6 +21,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -41,6 +41,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -24,6 +24,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -66,6 +66,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -30,6 +30,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
|
|
|
@ -24,6 +24,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
|
|
|
@ -21,6 +21,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||
|
|
|
@ -25,6 +25,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -39,6 +39,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -34,6 +34,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -40,6 +40,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -26,6 +26,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -25,6 +25,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -51,6 +51,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -27,6 +27,7 @@ EXIT STATUS
|
|||
|
||||
Exit status is 0 if the command was successful.
|
||||
Exit status is 1 if there was any error.
|
||||
Exit status is 11 if the repository is already locked.
|
||||
`,
|
||||
DisableAutoGenTag: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
|
@ -156,6 +156,8 @@ func main() {
|
|||
exitCode = 0
|
||||
case err == ErrInvalidSourceData:
|
||||
exitCode = 3
|
||||
case restic.IsAlreadyLocked(err):
|
||||
exitCode = 11
|
||||
case errors.Is(err, context.Canceled):
|
||||
exitCode = 130
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue