lmammino / godaddy-dns

A Node.js script to programmatically update GoDaddy DNS records
https://lmammino.github.io/godaddy-dns/
MIT License
78 stars 21 forks source link

cronjob not working. #34

Closed ovidiulaz7 closed 6 years ago

ovidiulaz7 commented 6 years ago

Log file output:

/bin/sh: 1: godaddy-dns: not found

which godaddy-dns /usr/local/bin/godaddy-dns

cronjob:

/5 * godaddy-dns > /var/log/godaddy-dns.log 2>&1

cronjob installed under root user.

any ideas?

if I type

godaddy-dns [Tue Jul 03 2018 12:19:10 GMT+0300 (EEST)] Current ip and last ip match. No update neccessary.

Thanks.

lmammino commented 6 years ago

Is NPM bin path exposed to your root user?

lmammino commented 6 years ago

if not you can try to use the full binary path in your cron definition. Something like:

*/5 * * * * /full/path/bin/godaddy-dns > /var/log/godaddy-dns.log 2>&1
ovidiulaz7 commented 6 years ago

If I run it in terminal just using 'godaddy-dns' with the root user it runs, so I think the npm bin path is exposed to root user..

I already tried with full path too:

/1 * /usr/local/bin/godaddy-dns > /var/log/godaddy-dns.log 2>&1

log output file:

/usr/bin/env: node: No such file or directory

lmammino commented 6 years ago

Then it seems node to be missing in your cron user...

ovidiulaz7 commented 6 years ago

which node /usr/local/bin/node

node --version v6.9.2

lmammino commented 6 years ago

Hey sorry for the delay, i hope you already figured it out but to me it seems that you are either missing node or /usr/bin/env for some reason is not present in your machine.

The following approach might work even though it might not be the cleanest:

*/1 * * * * /usr/local/bin/node /usr/local/bin/godaddy-dns > /var/log/godaddy-dns.log 2>&1
ovidiulaz7 commented 6 years ago

it works indeed.

thanks you for your time. :)

lmammino commented 6 years ago

Glad it works :)