We have /nxfilter/webapps/svrinfo.jsp to find out the current state of your NxFilter while it's running. This JSP page has been added by v4.5.2.4. With this page, you can write an auto-update script for NxFilter.
** We don't recommend you to use auto-update script in enterprise environment. You could run into an unexpected situation. You better update it while you are monitoring the update process.
There is 'type' parameter for the JSP page. And you can use the following values for the parameter,
You get the curent version of your NxFilter as a string like '4.5.2.6'. If you use 'newver' as the value for 'type' parameter, you get the latest version. You can compare them and if there is a newer version available then you can download it from our repository and then update your NxFilter.
If I write an example code, it would be like,
** You also can write an auto-restart script for the slave node in your cluster. Retrieve startTime from your master node and your slave node and then if your slave node's startTime is older than the one for your master node you can restart your slave node. It might be useful when you have multiple number of slave nodes and you want to restart whole cluster at once.
** We don't recommend you to use auto-update script in enterprise environment. You could run into an unexpected situation. You better update it while you are monitoring the update process.
There is 'type' parameter for the JSP page. And you can use the following values for the parameter,
- startTime - The start time of NxFilter as a unix timestamp
- uptime - The uptime of NxFilter as a unix timestamp
- lastLoad - The last configuration loading time as a unix timestamp
- curver - The current version of your NxFilter running as a string
- newver - The latest version available from our repository as a string
You get the curent version of your NxFilter as a string like '4.5.2.6'. If you use 'newver' as the value for 'type' parameter, you get the latest version. You can compare them and if there is a newer version available then you can download it from our repository and then update your NxFilter.
If I write an example code, it would be like,
Code:
curver = http_get("http://localhost/svrinfo.jsp?type=curver"); newver = http_get("http://localhost/svrinfo.jsp?type=newver"); if(newver > curver){ file = http_download("https://pub.nxfilter.org/nxfilter-${newver}.zip"); tempDir = "/home/myuser/temp/nxfilter-${newver}"; unzip(file, tempDir); exec("/nxfilter/bin/stop.sh"); copyFiles(tempDir + "/*", /nxfilter); exec("/nxfilter/bin/start.sh"); }
Comment