Katalonc is ignored when running crontab

  • Katalon Studio/ Katalon Runtime Engine Version: 7.6.2
  • OS Version: MacBook Pro Catalina
  • Browser Version: Version 84.0.4147.125 (Official Build) (64-bit)

I’m using version 7.6.2 on MAC. I can run katalonc from the command line. It also works when I put it into a shell script. But when I set crontab to run that shell script, it skips the katalonc command while running other commands like “echo”, “pwd”, “date”, etc. in that script.

Here is my crontab:
17 23 * * * ~/test/runKatalon.sh

And here is my runKatalon.sh:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#!/bin/bash

d=$(date)

echo “Start running test suite $d” >> ~/test/testCron.txt

/Katalon_Studio_Engine_MacOS-7.6.2/Katalon\ Studio\ Engine.app/Contents/MacOS/katalonc -noSplash -runMode=console -projectPath="/Documents/katalon/sm-katalon-automation/sm-katalon-automation.prj" -retry=1 -retryStrategy=allExecutions -testSuitePath=“Test Suites/E2E/BMSE2ETestCases” -executionProfile=“SLP-E2E-PROFILE” -browserType=“Chrome” -apiKey=“9c6bad47-ab7c-493f-b886-6cb4e18d8de5” --config -proxy.auth.option=NO_PROXY -proxy.system.option=NO_PROXY -proxy.system.applyToDesiredCapabilities=true

d=$(date)

echo “Done running test suite $d” >> ~/test/testCron.txt
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Again, running the script is working as expected. The problem is seen when crontab runs, the echo statements are written to the expected file. But the katalonc command is not executed. Any thoughts? Thanks.

@kim.tran01

You should provide Full Disk Access for cron first.

Please read the related discussion and apply the included solution: https://serverfault.com/questions/954586/osx-mojave-crontab-tmp-tmp-x-operation-not-permitted

Thanks @duyluong for looking at it. Terminal does have access to the full disk.
I redirected the cron job output to a log file and saw the issue with license. The cron job does trigger the katalonc process, but failed because the machineId does not match the one from license.
That makes me wonder why I don’t have that problem when running the shell script directly.

@kim.tran01

d=$(date)

echo "Start running test suite $d" >> ~/Desktop/test/testCron.txt

/Applications/Katalon\ Studio\ Engine.app/Contents/MacOS/katalonc

d=$(date)

echo "Done running test suite $d" >> ~/Desktop/test/testCron.txt

We tested with this shell script and it actually ran well. You should check the path to katalonc. Is it really at /Katalon_Studio_Engine_MacOS-7.6.2 folder?
After editting crontab, you should open: /var/mail/ to get the log of contab as well.

Warn: You should remove the API key at your first post. Navigate to https://analytics.katalon.com/ and login to remove and generate new API key for security reasons.

You can check if there are any errors while running the cron by configuring it as below.

*/1 * * * * cliclick -w 1 m:3,3 >> output.log 2>&1

the last part 2>&1 will redirect the STDERR to the output.log as well.