-
Notifications
You must be signed in to change notification settings - Fork 42
RDKB-63415 : Move SelfHeal Scripts to Cron #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -167,13 +167,44 @@ service_start () | |||||||||||||||||||||||||||
| # Don't Zero iptable Counter | ||||||||||||||||||||||||||||
| echo "58 * * * * /usr/bin/GenFWLog -nz" >> $CRONTAB_FILE | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # Monitor syscfg DB every 15minutes | ||||||||||||||||||||||||||||
| echo "*/15 * * * * /usr/ccsp/tad/syscfg_recover.sh" >> $CRONTAB_FILE | ||||||||||||||||||||||||||||
| SELFHEAL_CRON_ENABLE=$(syscfg get SelfHealCronEnable) | ||||||||||||||||||||||||||||
| SELFHEAL_ENABLE=$(syscfg get selfheal_enable) | ||||||||||||||||||||||||||||
| if [ "$SELFHEAL_CRON_ENABLE" = "true" ] && [ "$SELFHEAL_ENABLE" = "true" ]; then | ||||||||||||||||||||||||||||
| echo_t "SelfHeal Cron is enabled" | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
| # Monitor selfheal_aggressive.sh based on syscfg value | ||||||||||||||||||||||||||||
| AGGRESSIVE_INTERVAL=$(syscfg get AggressiveInterval) | ||||||||||||||||||||||||||||
| if [ -z "$AGGRESSIVE_INTERVAL" ]; then | ||||||||||||||||||||||||||||
| AGGRESSIVE_INTERVAL=5 | ||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||
| #Write cron rule | ||||||||||||||||||||||||||||
| echo "*/$AGGRESSIVE_INTERVAL * * * * /usr/ccsp/tad/selfheal_aggressive.sh" >> $CRONTAB_FILE | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
| # Monitor resource_monitor.sh based on syscfg value | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
| # Monitor resource_monitor.sh based on syscfg value | |
| # Monitor resource_monitor.sh based on syscfg value |
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected. Line 187 uses spaces for indentation but line 188 uses tabs and extra spaces. The echo statement should align with the indentation style used elsewhere in the file, which appears to use spaces consistently.
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing inconsistency in comment. There appears to be extra whitespace after "syscfg value". This comment should have consistent spacing with other similar comments in the block.
| # Monitor self_heal_connectivity_test.sh based on syscfg value | |
| # Monitor self_heal_connectivity_test.sh based on syscfg value |
Copilot
AI
Feb 18, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cron entries for selfheal_aggressive.sh, resource_monitor.sh, and self_heal_connectivity_test.sh are built directly from syscfg values (AggressiveInterval, resource_monitor_interval, ConnTest_PingInterval) without validating that they are numeric, so a malicious value containing spaces or additional fields can inject an arbitrary command into the crontab line and be executed as root. For example, if an attacker can set AggressiveInterval via any remote or untrusted configuration path to include extra cron fields and a custom command, the resulting echoed line will cause cron to run that attacker-controlled command instead of the intended script. Restrict these intervals to a safe numeric range (e.g., via a regex or arithmetic check) before use, and reject or sanitize any value that is not purely numeric to prevent cron injection.
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected after the cron rule. The line should end immediately after CRONTAB_FILE without any trailing spaces or tabs, for consistency with other cron entries in the file.
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected. This line uses a tab character, while the surrounding code consistently uses spaces for indentation. The echo_t statement should align with the indentation style used elsewhere in the file.
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected. The line should not have any spaces or tabs after the closing quote, for consistency with other lines in the file.
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected. This line uses a tab character, while the surrounding code consistently uses spaces for indentation. The echo_t statement should align with the indentation style used elsewhere in the file.
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing inconsistency in comment. There appears to be extra whitespace after the comment text. This comment should end immediately after "15minutes" without trailing spaces for consistency with other comments in the file.
Copilot
AI
Feb 18, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, syscfg_recover.sh is only scheduled when SelfHeal cron is disabled. If monitoring/recovering the syscfg DB is still required when SelfHeal cron is enabled, this is a behavior change from the previous unconditional cron entry. Consider keeping syscfg_recover.sh scheduled in both modes or explicitly replacing that functionality in the enabled branch.
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected. This line uses a tab character, while the surrounding code consistently uses spaces for indentation. The echo statement should align with the indentation style used elsewhere in the file.
Copilot
AI
Feb 18, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resource_monitor_recover.sh cron entry is now inside the else branch, so it will only run when SelfHealCronEnable/selfheal_enable are not both true. Previously this job ran unconditionally; if it’s still required regardless of SelfHeal cron mode, move it (and its comment) outside the conditional or add it to both branches to avoid losing the recovery behavior when SelfHeal cron is enabled.
| # Monitor resource_monitor.sh every 5 minutes TCCBR-3288 | |
| # if [ "$BOX_TYPE" = "TCCBR" ]; then | |
| echo "*/5 * * * * /usr/ccsp/tad/resource_monitor_recover.sh" >> $CRONTAB_FILE | |
| # fi | |
| fi | |
| fi | |
| # Monitor resource_monitor.sh every 5 minutes TCCBR-3288 | |
| # if [ "$BOX_TYPE" = "TCCBR" ]; then | |
| echo "*/5 * * * * /usr/ccsp/tad/resource_monitor_recover.sh" >> $CRONTAB_FILE | |
| # fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolve the merge conflict , also add this to bci and xle system defaults file.