Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion fileUploadRandom.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

Check failure on line 1 in fileUploadRandom.sh

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'fileUploadRandom.sh' (Match: rdkb/components/opensource/ccsp/sysint/rdkb/components/opensource/ccsp/sysint/1, 334 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/sysint/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: fileUploadRandom.sh)
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
Expand Down Expand Up @@ -45,6 +45,23 @@
mkdir -p "$FILEUPLOAD_TMP_DIR"
fi

rdklogger_cron_enable=`syscfg get RdkbLogCronEnable`
if [ "$rdklogger_cron_enable" = "true" ]; then
CRON_MODE=1
LOCKFILE="/tmp/randomfile_cron.lock"
if [ -f "$LOCKFILE" ]; then
old_pid=$(cat "$LOCKFILE" 2>/dev/null)
if [ -n "$old_pid" ] && kill -0 "$old_pid" 2>/dev/null; then
echo_t "Already a cron instance is running for fileUploadRandom file; No 2nd instance"
exit 0
fi
rm -f "$LOCKFILE"
fi
echo $$ > "$LOCKFILE"
cleanup() { rm -f "$LOCKFILE"; }
trap cleanup EXIT
fi

generate_random_delay()
{
rand_hr=0
Expand Down Expand Up @@ -90,7 +107,6 @@

if [ "$remaining" -le 300 ]; then
echo_t "fileupload_random: Sleeping $remaining seconds now" >> "$NEXT_UPLOAD_TIME_FILE"
rm -f "$DELAY_REMAINING_FILE" "$HEARTBEAT_TICK_FILE"
delay_completed=1
[ "$remaining" -gt 0 ] && sleep "$remaining"
else
Expand Down Expand Up @@ -246,6 +262,9 @@
fi

createSysDescr
if [ "$CRON_MODE" = "1" ]; then
rm -f "$DELAY_REMAINING_FILE" "$HEARTBEAT_TICK_FILE"
fi
}


Expand Down
Loading
Loading