'OnCanRunProfile' not working

English Support for Syncovery on Windows.
Post Reply
PeterC
Posts: 28
Joined: Thu Jan 05, 2023 11:18 pm

'OnCanRunProfile' not working

Post by PeterC »

I have 2 profiles that I don't want to run at the same time. The profile names (taken from the 'Rename Profile' dialog box) are:
• p1 "[chn00] C:\(slctd,excl)--SamsungT7-L:\UserData" &
• p2 "[chn20] SamsungT7-L--Wombat (sleep)"

I have them in different 'Profile Groups' as shown in the below screenshot.
20250712 OnCanRunProfile.jpg
20250712 OnCanRunProfile.jpg (42.62 KiB) Viewed 68 times
In Program Settings > Advanced > Global Pascal Script for All Profiies... I have the script:

Code: Select all

const p1='[chn00] C:\(slctd,excl)--SamsungT7-L:\UserData';
      p2='[chn20] SamsungT7-L--Wombat (sleep)';

function OnCanRunProfile(const ProfileName:UnicodeString; var PostponeBySeconds:Integer):Boolean;
begin
  if ProfileName=p1 then
     Result:=not ProfileRunning(p2)
  else
     if ProfileName=p2 then
       Result:=not ProfileRunning(p1)
     else
       Result:=true;
  if not Result then
     PostponeBySeconds:=60;
  end;
My problem is I'm still getting these 2 profiles running simulateously.
tobias
Posts: 1982
Joined: Tue Mar 31, 2020 7:37 pm

Re: 'OnCanRunProfile' not working

Post by tobias »

Hello,
can you describe more precisely under which circumstances this happens? Does the scheduler start them? What's the schedule that the profiles have?

How frequently does it happen? Do you ever see the scheduler reporting "Not running job due to PascalScript"? Or does the PascalScript never prevent the second start?

It works fine here, the only situation I could imagine where it can happen is if the scheduler starts them almost at the same time, and the script might not work in that case.
PeterC
Posts: 28
Joined: Thu Jan 05, 2023 11:18 pm

Re: 'OnCanRunProfile' not working

Post by PeterC »

The scheduler starts p1 every 30 min at approx. 00:15/00:45 of the hour.

p2 is run as the third of 3 profiles that run in sequence started by the scheduler at 00:00 daily (I have them set up under 'Job' 'Execute after' with 'RUN PROFILE').

p2 takes anywhere from a few min to a few hours to run and I think the conflict happens every time p2 takes longer than 30 min. I never see the scheduler reporting "Not running job due to PascalScript".
Post Reply