Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
ipolovokhin
Contributor
Jump to solution

Job scheduler don't save changes.

Good afternoon, dear community.

I have a question regarding job scheduler.

I wish to create some scheduled job for save config files.

I try to create some scheduled jobs, but if i use some variables in my commands changes couldn't be saved. It's just ignored.

For example if i try to set command <clish -c "save configuration backup123"> it will be saved fine.

If i try to set command <clish -c "save configuration ${HOSTNAME}_backup_$(date +"%d-%m-%Y")">  sheduled job doesn't save changes.

I also try to create #/bin/bash! script and place it to /usr/bin/ directory with +x permissions but result the same...

From console in expert mode all operations works fine.

I try it on Security Gateway SG5100 which running on Gaia r81.20

0 Kudos
1 Solution

Accepted Solutions
ipolovokhin
Contributor

I found the solution, I solve it by call script.

command syntax which work:

/bin/sh /usr/bin/saveconfig.sh

Great thanks to all participants!

View solution in original post

7 Replies
_Val_
Admin
Admin

CLISH "save configuration" command does not support any scheduling. You may want to run a cron script, if you want the backups to be scheduled. 

Also you can look here: https://sc1.checkpoint.com/documents/R81.10/WebAdminGuides/EN/CP_R81.10_Gaia_AdminGuide/Topics-GAG/W...

 

0 Kudos
ipolovokhin
Contributor

Dear _Val_,

I have 2 question in this case.

1) If LISH "save configuration" command does not support, why clish -c "save configuration backup123" works fine?

Looks like job scheduler don't save changes because system variables used in command syntax.

2) I tried to schedule in job scheduler (cron) bin/bash script which i previously create by myself on equipment.

Command syntax was <./saveconfig.sh> of course i place saveconfig.sh in /usr/bin/ directory with executable permissions.

Body of safeconfig.sh:
__________________________________________________________________________________________

#!/bin/bash

clish -c "save configuration ${HOSTNAME}_backup_$(date +"%d-%m-%Y")"

__________________________________________________________________________________________

I also tried this script in console in expert mode and it works fine.

And please, correct me if i'm wrong. Behind link that you shared documentation about save configuration command. Which corn script you are meaning?

Снимок экрана 2024-05-29 151548.png

0 Kudos
Bob_Zimmerman
Authority
Authority

He meant cron, not corn. I'm betting autocorrect was being its normal, unhelpful self.

As for the script you shared, keep in mind cronjobs don't get any environment. The HOSTNAME variable isn't set, and it may not have a path to clish. Be sure to include this line to set up the Check Point environment:

. /etc/profile.d/CP.sh

And be sure to either set the $PATH or use the full path to clish.

_Val_
Admin
Admin

Exactly that, thanks @Bob_Zimmerman 

0 Kudos
_Val_
Admin
Admin

What I am saying is, CLISH does not support any of the variables you want to use natively. You have to feed it from bash, and run the command with the help of "clish -c" expert command. Which, as I can see, you already know how to do.

And yes, I meant cron, fixed above as well

0 Kudos
ipolovokhin
Contributor

I found the solution, I solve it by call script.

command syntax which work:

/bin/sh /usr/bin/saveconfig.sh

Great thanks to all participants!

_Val_
Admin
Admin

great to hear

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events