The forum for help and support with FreeNATS as well as any useful hints and tips
- Posts: 1
- Joined: Sat Aug 19, 2017 8:56 pm
I found the FreeNATS script and wanted to install it. Installation went quite well, except the tester-scripts.
I have shell access to my server, but I can't set cronjobs here - my webhoster offers me web-Cronjobs (calling a php script by HTTP/HTTPS), but it seems as this is not an official supported way.
I digged through the scripts myselve and copied tester.php and test-threaded.php to webroot and changed the include to require("../bin/include.php");
Sadly the scripts still don't run. By manually calling them (HTTPS Request) they output following:
Code: Select all
test-threaded.sh: spawning node tester processes php ./tester.php freenats > /tmp/nr.freenats &
Warning: exec() has been disabled for security reasons in /www/htdocs/wwwroot/test-threaded.php on line 45
Code: Select all
NATS Tester Script Starting Tester Already Running: Cleared Test ID: 52 (Started at 18:27:50 26/08/2017) NodeID: freenats Ping Test: Yes
Fatal error: Call to undefined function socket_create() in /www/htdocs/base/tests/ppping.inc.php on line 263
How can I get FreeNATS running without a proper cronjob - just webcron?
Thank's in advance
- Site Admin
- Posts: 260
- Joined: Fri May 30, 2008 9:09 pm
- Location: UK
I'm afraid the answer may well be you may only be able to run certain tests because of the permissions level.
test-threaded.sh simply relies on being able to exec() instances of tester.sh for specific nodes, and it seems the error shows your web host denies this.
For the tester on it's own this is a little more complex - the script itself is running ok, where it's failing is in the ping test. Ping uses low-level sockets which normally require root privileges to create and in your case it looks even worse in that the socket stuff isn't even compiled into the PHP version.
What sort of tests do you want to run?
Tests which require sockets include the ping, port, and DNS Query tests - other ones such as: web time, web size, dns host lookup, the mysql set, and IMAP could well work.
What you'll need to do is turn off "Ping Test" in the node settings and then try again. You can add tests and see if they work or cause it to fail.
There is another option as well - installations normally have two PHP versions, one used by the web server and one used on the CLI. Setting up FreeNATS to run via cron uses the CLI one which (often) has more permissions allowed etc. In addition to trying to run via a HTTP call try running it from the command line: ./test-threaded.sh.
Now if that works ok (ping won't still because you're not root) what you could consider is running a script, either as a background process or using screen or similar, which just calls test-threaded, waits 60 seconds, and repeats. This wouldn't be a cron job just a simple script running endlessly in a loop, just something to consider.