Set policies by CLI

Hi all.
I’m very frustated because I feell imposible to set scheduling (cron format) policies by CLI.
Reference just says:
–snapshot-time-crontab Semicolon-separated crontab-compatible expressions (or ‘inherit’)

but no examples.

I have tried as is but I get sh erros:
kopia policy set --snapshot-time-crontab ;;;;* global

Then this:
kopia policy set --snapshot-time-crontab “;;;;*” global

but getting this error:
Setting policy for root@kopia:/global

  • setting cron snapshot times to [* * * * ]
    ERROR scheduling policy: invalid scheduling policy: invalid cron expression "
    "

Then I have tried every single conbination I have imagined for typing the cron expression and I always get the same error:
ERROR scheduling policy: invalid scheduling policy: invalid cron expression

Examples:

;;;;"
"
* * * "
"[
;;;;]”
“[* * * * ]"
[
;;;;]
[* * * * ]
["
;;;;”]
[“* * * * *”]

I have testted this cron expresion * * * * * and others as well but always checking them first in web UI, so all of them are correct dor the web UI. In fact my first attempt was for this cron expression: 33 3 * * *

What the hell I’m doing wrong? Or maybe this is a bug?

Thank you in advance.

I have realized about another problem. Setting global as target doesn’t afect the global policies but the /global directorie instead…
but using -global as target (following reference) gives this error:
kopia: error: unknown short flag ‘-g’, try --help

This is very frustating…

This is not a bug - you just don’t do it right.

Here how to do it:

$ kopia policy set --snapshot-time-crontab "33 3 * * *" --global

$ kopia policy set --snapshot-time-crontab "33 3 * * *;15 11 * * *" --global

semicolons separate multiple crontab schedules if you need more than one.

Documentation could be made more clearer. Simple example would help.

Feel free to submit PR.

global is a directory name

--global is a flag instructing to modify global policy

as per docs:

target
Select a particular policy (‘user@host’,’@host’,‘user@host:path’ or a local path). Use --global to target the global policy.

-- was truncated to in docs. Again feel free to correct it.

Thank you very much.

1 Like

Sorry, but I cannot find file to edit and PR in the github repo. This is the closest one, but I don’t find nothing for common commands…
Can you help me about this…?

1 Like

Thank you for considering improving kopia! This is the right attitude.

You can find it by clicking at links here (red circle):

Sorry, no luck: the link for editing or view source is dead.


I just can create an Issue…

You are right! oups. I am sorry for pointing you into wrong direction.

Can anybody more familiar with this repo help here please?