We have a simple query and insert using C code linking to mysql db. The issue now on itself the script works fine. But when we put to run as a cron job the select query gives empty results and when we run back on the db there is results. It really puzzle as to what extra should be done for it to a cron job?
newbie14 0 Posting Pro
Recommended Answers
Jump to PostHello,
It is hard to tell what is wrong without seeing the cron entry you ae using or the code. However the first things that come to mind are that cron jobs are not run with the same environment variables as a normal user. You have to call the program …
Jump to PostHello,
I don't know enough about C programming to be able to tell you what to do there but I suggest that you try putting your variables into a shell script file with the c program called at the very end and call that program instead of the c file:
…
Jump to PostHello,
Ok so how does you program normally return the results? If it normally displays to the screen then you need to redirect the output to a file either from within your C code or by redirecting STDOUT in the shell script:
/home/test1/userland/examples/receive1.c > /home/test1/userland/examples/output
I code alot with perl …
All 11 Replies
rch1231 169 Posting Shark
CimmerianX 197 Junior Poster
newbie14 0 Posting Pro
rch1231 169 Posting Shark
newbie14 0 Posting Pro
rch1231 169 Posting Shark
newbie14 0 Posting Pro
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
newbie14 0 Posting Pro
rch1231 169 Posting Shark
newbie14 0 Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.