So, I've made a Twitter bot using node.js, slightly modified from this guide, which is supposed to send a tweet every two hours (using Javascript's setInterval()
function). Running on a Windows 7 laptop, this works fine. It also works fine on my Raspberry Pi 3 when I set it for a short timer, say, a few minutes, but set to two hours it does nothing. No error message or anything, the terminal window just doesn't seem to do anything at all.
My OS is Ubuntu MATE 16.04 (specifically, the version for Raspberry Pi), but I've also tried Raspbian with no success.
Node.js is version 6.9.2, though I initially had version 4.6 or so (IIRC).
At first I thought the problem may be the system going into some kind of power saving mode, but I've tried using Caffeine and even having the Pi ping itself every few seconds, but no success there, either.
I suspect that the problem is that the Pi doesn't have an internal clock and thus can't run the script's setInterval()
function accurately. So, since I first posted this question, I have bought an RTC module, and set it up using this guide (technically for Ubuntu MATE 15.10). The clock is working, which is nice, but the script still does not run when set for more than a few minutes.