Skip to content

"source" command not working in "cronitor exec" #25

@AshleyJackson

Description

@AshleyJackson

There is an issue with the CLI where the below examples fail to source any data from other shell scripts. If I run the source command to the shell scripts manually in terminal, it works without any issues. I've tried to around this issue with escaping characters here and there and nothing comes up.

Cronfile.cron

TESTRC="/clients/client1/scheme/config/exports.sh"
*/3 * * * * client1 cronitor exec qa***" source \"$TESTRC\" && $TEST_APP_PATH/bin/TEST_process_email_queue.php $TEST_CONFIG 50"

exports.sh

CLIENT="client1"
source "/clients/${CLIENT}/program/bin/commonrc"
export TZ="Europe/London"

/clients/${CLIENT}/program/bin/commonrc

TEST_PROG_PATH="/clients/${CLIENT}"
TEST_APP_PATH="${TEST_PROG_PATH}/program"
TEST_CONFIG="${TEST_PROG_PATH}/scheme/config/central.conf"

Terminal - Echo Client

~ # cronitor -v -l test.log exec qa*** "source \"$TESTRC\" && echo $CLIENT"
Reading config from /etc/cronitor/cronitor.json
Running subcommand: source "/clients/client/scheme/config/exports.sh" && echo
Sending ping https://cronitor.link/ping/a30433eb4**********************/qa****?state=run&try=1&stamp=1728337790.035&msg=source+%22%2F*******%2F*****%2Fscheme%2Fconfig%2Fexports.sh%22+%26%26+echo&host=****************************&series=1728337790.035&env=Production

Terminal - Echo $TEST_APP_PATH

~ # cronitor -v -l test.log exec qa****"source \"$TESTRC\" && echo $TEST_APP_PATH"
Reading config from /etc/cronitor/cronitor.json
Running subcommand: source "/clients/client1/scheme/config/exports.sh" && echo
Sending ping https://cronitor.link/ping/a30433eb48*******************/qa******?state=run&try=1&stamp=1728337580.752&msg=source+%22%2F*************%2F*************%2Fscheme%2Fconfig%2Fexports.sh%22+%26%26+echo&host=******************&series=1728337580.752&env=Production

Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions