How to schedule vsql command from cron job ?

Moderator: NorbertKrupa

Post Reply
verticatest
Newbie
Newbie
Posts: 2
Joined: Thu Apr 03, 2014 1:51 pm

How to schedule vsql command from cron job ?

Post by verticatest » Thu Apr 03, 2014 2:28 pm

Hi,

I have created a file say testquery and when I am running this executable file ./testquery , it is executing perfectly , that is connecting to database and inserting a new record.However, when I am scheduling the same file using cron job it is failing with the error msg : vsql command not found.

Following is the two lines of code in that file (testquery):

cd /opt/vertica/bin/
vsql -d dbname -c "insert into testtable values(100,'aaa',200);commit;" -U dbadmin -w test



Plz help me in resolving this issue.


Thanks
martyn

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: How to schedule vsql command from cron job ?

Post by JimKnicely » Thu Apr 03, 2014 3:45 pm

Instead of changing the directory, can you use the full path to vsql like this?

/opt/vertica/bin/vsql -d dbname -c "insert into testtable values(100,'aaa',200);commit;" -U dbadmin -w test
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

verticatest
Newbie
Newbie
Posts: 2
Joined: Thu Apr 03, 2014 1:51 pm

Re: How to schedule vsql command from cron job ?

Post by verticatest » Fri Apr 04, 2014 2:54 pm

Thanks a ton "knicely87", it worked.


Thanks again
Martyn

Post Reply

Return to “General”