This bash script will help you launch apex scripts.
To launch the scripts, is using the command:
sfdx force:apex:execute -u <alias> -f <script.apex>
link: https://github.com/d2269/SFScripts/tree/main/bash/running_apex_scripts
Script:
#!/bin/bash
| # automatic launch of scripts from the directory |
| # getting a list of scripts from the current directory |
| for eachscript in $scipts |
| for eachscript in $scipts |
| echo "===== $eachscript is running" |
| sfdx force:apex:execute -u $org -f $eachscript > "debug_${eachscript}".txt # running the script and logging |
| echo "debug_${eachscript}.txt has been created" |
| echo "checking for the condition" |
| # checking for the success of the script execution |
| if grep "Executed successfully." debug_${eachscript}.txt; then |
| echo -e "\033[32m $eachscript was executed successfully${NC} \033[0m " |
| echo -e "\033[31m !!! $eachscript FAILED !!!!${NC} \033[0m " |
| cat debug_${eachscript}.txt |
echo "===== completed ====="
No comments:
Post a Comment