Open arnaudom opened 6 years ago
Try this: instead of cat ~/test_email.txt
, use the full path i.e. cat /Users/root/test_email.txt
In the script file, console is triggered with full path : /var/www/App/vendor/drupal/console/bin/drupal . (~ is only use in the manual test to pickup the test file and pipe it to the script, which is working as expected).
drupal: command errors when called from bash file
I am trying to launch a custom command from bash file. The bash file (postfix.sh) is called by postfix when receiving email from multisites configuration and will run the following command:
[1]
drupal --uri=${array[1]} custom:pipemail
where ${array[1]} is the target site.
When executing the command manually as test from console, drupal command is executed normally, i.e.:
cat ~/test_email.txt | /path/to/postfix.sh -d <from@email> <size> <to@email>
custom:pipemail
is executed subsequentlyHowever when postfix call the same bash file directly, as below example
the command is not executed:
In both cases (manual or postfix) it is confirmed that the same server user is used and the command is called within the drupal installation folder;
When changing the path in [1] above with full path to drupal console:
/path/to/vendor/drupal/console/bin/drupal,
the command run, but will generate the following error:Question: what would be the way to simply run "drupal" in bash script with same result as when it is called from the console ?
Thank you in advance for support.