Sebastian,

The delete-canceled-job.sh script schedules an at job to run in 5 minutes 
to delete the job if it has a canceled status. So no, the script is not 
sending a cancel command. This script is being executed twice immediately 
at the end of the job. 
I see the double run when I cancel it manually and when bareos cancels it 
due to another job of the same name already running.

Why would bareos run the script both when the job is canceled and when it's 
finished? I can't think of why one would want that behavior.

On Wednesday, November 6, 2024 at 1:01:34 AM UTC-6 Sebastian Sura wrote:

> Hi Jon
>
> it looks like "AfterJob" RunScripts are run when 1) a cancel command is 
> received for that job and 2) when the job is finished.
> Is it possible that your delete-canceled-job.sh script tries to cancel the 
> job ? Or was this job canceled manually ?
> Either case would explain what you are seeing.  Feel free to open an issue 
> about this as it looks like a logic bug.
>
> Kind Regards
>
> Sebastian Sura
> Am 29.10.24 um 15:29 schrieb Jon Schewe:
>
> I have a RunScript setup to execute after all of my jobs and I'm finding 
> that it's running twice rather than the expected once.
>
> Here is my configuration and the output from a run.
> Job {
>   Name = "filer-01.bbn.com-onsite"
>   JobDefs = "onsite-LTO-8"
>   Client = "filer-01.bbn.com-fd"
>   FileSet = "filer-01.bbn.com"
> }
>
> JobDefs {
>   Name = "onsite-LTO-8"
>
> #  JobDefs = "base"
> # base.conf
>
>   Type = Backup
>   Level = Incremental
>   Messages = Standard
>   Write Bootstrap = "/var/lib/bareos/%c.bsr"
>
>   Priority = 30
>
>   Rerun Failed Levels = yes
>   Accurate = yes
>   Spool Data = yes
>
>   # retry failed backups
>   Reschedule On Error = yes
>   Reschedule Interval = 1 minute 
>   Reschedule Times = 10
>   
>   AllowDuplicateJobs = no
>   CancelLowerLevelDuplicates = yes
>   CancelQueuedDuplicates = yes
>
>   # handle long running jobs and canceling duplicates
>   RunScript {
>     RunsWhen = After
>     RunsOnFailure = Yes
>     FailJobOnError = No
>     RunsOnClient = No
>     Command = "/etc/bareos/delete-canceled-job.sh %e %i"
>   }
>
>
>  # # backup bootstrap files to DRS site
>  # RunScript {
>  #    RunsOnClient = no
>  #    RunsWhen = After
>  #    FailJobOnError = no
>  #    Command = "/usr/local/bum/sbin/copy-bareos-bootstrap.sh"
>  #  }
>
> # end base.conf
>
>   Schedule = "WeeklyCycle"
>   Pool = onsite-LTO-8
>   Storage = LTO-8
>
>   Next Pool = offsite-LTO-8
> }
>
>  2024-10-29 10:19:52 bareos-dir JobId 214: shell command: run AfterJob 
> "/etc/bareos/delete-canceled-job.sh Canceled 214"
>  2024-10-29 10:19:52 bareos-dir JobId 214: AfterJob: Deleting canceled job 
> 214
>  2024-10-29 10:19:52 bareos-dir JobId 214: AfterJob: warning: commands 
> will be executed using /bin/sh
>  2024-10-29 10:19:52 bareos-dir JobId 214: AfterJob: job 35 at Tue Oct 29 
> 10:49:00 2024
>  2024-10-29 10:19:52 bareos-dir JobId 214: shell command: run AfterJob 
> "/etc/bareos/delete-canceled-job.sh Canceled 214"
>  2024-10-29 10:19:52 bareos-dir JobId 214: AfterJob: Deleting canceled job 
> 214
>  2024-10-29 10:19:52 bareos-dir JobId 214: AfterJob: warning: commands 
> will be executed using /bin/sh
>  2024-10-29 10:19:52 bareos-dir JobId 214: AfterJob: job 36 at Tue Oct 29 
> 10:49:00 2024
>
> Can anyone give me some ideas as to why the RunScript is executing twice?
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "bareos-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion visit 
> https://groups.google.com/d/msgid/bareos-users/f366bc1e-baf7-4dda-b13e-569edd63f4ffn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/bareos-users/f366bc1e-baf7-4dda-b13e-569edd63f4ffn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> -- 
>  Sebastian Sura                  [email protected]
>  Bareos GmbH & Co. KG            Phone: +49 221 630693-0
>  https://www.bareos.com
>  Sitz der Gesellschaft: Köln | Amtsgericht Köln: HRA 29646
>  Komplementär: Bareos Verwaltungs-GmbH
>  Geschäftsführer: Stephan Dühr, Jörg Steffens, Philipp Storz
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/bareos-users/4ba300a7-4ef0-4486-ad50-157493b520b2n%40googlegroups.com.

Reply via email to