+magicParseCustomTTL() {
+ # Desc: Set user-specified TTLs for buffer and script
+ # Input: vars: argCustomBufferTTL (integer), argCustomScriptTTL_TE (string)
+ # Input: vars: OPTION_CUSTOM_BUFFERTTL, OPTION_CUSTOM_SCRIPTTTL
+ # Input: vars: BUFFER_TTL (integer), SCRIPT_TTL_TE (string)
+ # Output: BUFFER_TTL (integer), SCRIPT_TTL_TE (string)
+ # Depends validateInput(), showUsage(), yell
+
+ # React to '-b, --buffer-ttl' option
+ if [[ "$OPTION_CUSTOM_BUFFERTTL" = "true" ]]; then
+ ## T: Check if argCustomBufferTTL is an integer
+ if validateInput "$argCustomBufferTTL" "integer"; then
+ ### T: argCustomBufferTTL is an integer
+ BUFFER_TTL="$argCustomBufferTTL";
+ else
+ ### F: argcustomBufferTTL is not an integer
+ yell "ERROR:Invalid integer argument for custom buffer time-to-live."; showUsage; exit 1;
+ fi;
+ ## F: do not change BUFFER_TTL
+ fi;
+
+ # React to '-B, --script-ttl' option
+ if [[ "$OPTION_CUSTOM_SCRIPTTTL_TE" = "true" ]]; then
+ ## T: Check if argCustomScriptTTL is a time element (ex: "day", "hour")
+ if validateInput "$argCustomScriptTTL" "time_element"; then
+ ### T: argCustomScriptTTL is a time element
+ SCRIPT_TTL_TE="$argCustomScriptTTL";
+ else
+ ### F: argcustomScriptTTL is not a time element
+ yell "ERROR:Invalid time element argument for custom script time-to-live."; showUsage; exit 1;
+ fi;
+ ## F: do not change SCRIPT_TTL_TE
+ fi;
+} # Sets custom script or buffer TTL if specified
+