简体   繁体   中英

Cron Jobs Fail to Trigger Node.js Script on External Server

I have a node.js application on a Windows Server and a series of cron jobs setup via cPanel on an external CENTOS server. The cron jobs all target the URL of my node.js application using wget . I confirmed that the jobs are running according to the cron logs in WHM, but they are not causing the script on the other server to run as they should.

The format of the cron jobs are like this:

wget -q -O - "http://example.com/app?&param=1&param=2" >/dev/null 2>&1

The result of the cron job should be the execution of the script on the other server. That script uses Puppeteer to scrape web pages, take screenshots, parse the results into RSS feeds, and create rss formatted XML files on the file system. Despite the cron jobs firing and targeting the right URLs, I have yet to see a single cron job result in a new image or xml file being created.

This leads me to wonder if there is something I don't know about when it comes to cPanel, cron jobs and javascript . I'm thinking maybe they won't work with URLs leading to javascript files, but if that were true then wouldn't I have the same problem when executing the same commands via SSH? I just tried one using the WHM terminal and it triggered the desired result.

I think the issues was due to the firewall on the IIS server. I added the remote IP address to the whitelist and now the cron jobs work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM