Cronjob issue, DH support don't offer help


#1

Hello all,
So, i’ve got a .sh script that works just fine when i trigger it manually in SSH (it connects to DB1 via API on external server, and stores data in DB2 hosted on DH):

bash -x /home/surrealm/dvh/pdgadb-update-players.sh

gives EXACTLY the result i need, without ANY error.

When i try to set up a cronjob, i would either get error “sh: no such file or directory” , or nothing would happen (not receiving email would however suggest that script works normally)

To bypass DH panel, i removed cronjob and set it manually in SSH.

This is what it says now, when i do cronjob -l

PDGA players

MAILTO="mail@pdga-europe.com"
0 4,16 * * * /home/surrealm/dvh/pdgadb-update-players.sh"

But NOTHING happens; no error messages, no result in DB.

My script programmer says i should try to have the script executed by bash instead of sh.

DH are not (willing or capable?) to help me out with that part, and keep referring me to this forum.
Can anyone of you please help me fix this issue?


#2

You didn’t mention which dreamhost product you’re using… i.e. shared/VPS/Dedicated/dreamcompute.

So why did you set it up that way? To mimic what you are doing at the command prompt, I would expect to see:

0 4,16 * * * bash -x /home/surrealm/dvh/pdgadb-update-players.sh

or perhaps

0 4,16 * * * /bin/bash -x /home/surrealm/dvh/pdgadb-update-players.sh

short of that your script programmer should probably add a line to append the current date/time to a start time logfile. I’d use something very simple near the top of the script (the first line does contain a shebang, correct?). Once you’ve done that you can prove whether cron is never starting the script, or cron is starting it and something is going wrong thereafter. With that information we can continue to help you troubleshoot.

Don’t rely on the email. Dreamhost email from webservers is wonky at best. If you need output from your script capture it in a file for review.


#3

Hi LakeRat,
I’m using a CodeWarrior plan (not sure they still exist; i joined DH in the 20th century)

Why I set up what i did, the way i did?
I’ve only got API access (limited to 200 records per time) to the 3rd party DB. I need access to all 75k+ records, and for that I use that tried and tested .SH script that calls instances of 200 records each time, and writes to my DB.

I could resort to manually triggering the script in SSH, but that counteracts the whole DB being accurate in real-time.
By that cronjob (first, i want to see server load when i run it every 12 hours, i’ll most likely update to every 2 or 4 hours, if it proves not to be too heavy to run.

I tried your "adding “bash -x” or /bin/bash to crontab but to no avail.
I’ve not had time yet for any other tests.


#4

The point of my post was that the cron was not the same as your command line entry.

Short time of that correction, you will need to figure out next whether cron is never running, or it is and failing because the environment is not similar enough to what you have at the command prompt.

Cron really isn’t difficult, it’s almost the same thing as typing at the command prompt, but not quite.


#5

Someone at DH will have a look at syslogs, and then I’ll know more.