0

I am trying to test a very simple VSQL query crontab job within my Bash environment in Windows 10 to automate some of the Vertica pulls I do for work on a regular basis. I made sure to set up VSQL correctly for the Bash environment specifically by downloading and extracting the relevant Vertica client into /opt/vertica/bin and then added this to PATH= in ~/.profile. Using the command vsql in Bash works.

I want to run the following executable script in crontab:

#!/usr/bin/env bash

vsql -dxxxxxxx -hxxxxxxxxxxx-Uxxxxxxx -wxxxxxxxxxxxx -f /mnt/c/Users/Even.Chandler/Documents/code/sql/script.sql -o /mnt/c/Users/Even.Chandler/Desktop/test.txt

From reading some previous questions on similar topics, I know I need to specifically call out the environment to be used for this pull, but this is where I am unsure. I tried including export PATH="/opt/vertica/bin" in the script file, but that still doesn't run the crontab job. Do I need to reference ./profile in some way? I have tested the bash script on its own as well as running a separate simple crontab job to make sure that stuff is set up correctly and both work. Here is the crontab job I am trying to run:

0 10 * * 1 /mnt/c/Users/Even.Chandler/Desktop/vsql_crontab
Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
naveman8
  • 1
  • 2

1 Answers1

0

I solved it. I should have simply written /opt/vertica/bin/vsql right in the script instead of using export PATH=.

naveman8
  • 1
  • 2