I am using OCI CLI in ubuntu to automate a couple of things using crontab. While using and oci command,ex:
oci --help
I get a list of oci commands. However, as soon as I put it into a bash:
#!/bin/bash
oci --help
and do the crontab with log, I get the error message:
/home/ubuntu/lib/oracle-cli/bin/test: line 2: oci: command not found
Any ideas ?
CodePudding user response:
When it opens a shell, cron will not inherit the environment variables (like PATH
) that you use from the command prompt. You need to include the complete, explicit path to the oci
command in your script. You can find this from your command prompt with the which
command, as follows:
which oci
CodePudding user response:
This can be caused by one of the following reasons:
- pip installed the package to a different virtual environment than your active one.
- You switched to a different active virtual environment after you installed the CLI.
To determine where the CLI is installed, run the
which pip
and
which oci
commands.