Skip to content

Instantly share code, notes, and snippets.

@pchittum
Last active September 23, 2018 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pchittum/8c07c56468a59e2eb900a720bc9ca293 to your computer and use it in GitHub Desktop.
Save pchittum/8c07c56468a59e2eb900a720bc9ca293 to your computer and use it in GitHub Desktop.
Running a dx command in shell script through cron fails
*/2 * * * * /Users/pchittum/Stuff/git/sfdx-projects/norf/writeapexlog.sh
#!/bin/bash
PATH=/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin
#these work ok
date >> /Users/pchittum/Stuff/git/sfdx-projects/norf/Test.log
echo 'hello again' >> /Users/pchittum/Stuff/git/sfdx-projects/norf/Test.log
#this does not
concurrent=$(sfdx force:limits:api:display -u blixtar | grep 'Storage')
echo "${concurrent}" >> /Users/pchittum/Stuff/git/sfdx-projects/norf/DailyOrgStorage.log
@pchittum
Copy link
Author

So bizarre.

The following works fine:

> ./writeapexlog.sh

As does the full path

> /Users/pchittum/Stuff/git/sfdx-projects/norf/writeapexlog.sh

And the output from ls -al for the .sh and sfdx are as follows

-rwxr-xr-x@ 1 pchittum  staff  456 Sep 22 07:25 writeapexlog.sh 

lrwxr-xr-x  1 root  admin  28 Nov  3  2017 /usr/local/bin/sfdx -> /usr/local/lib/sfdx/bin/sfdx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment