Menu

yfi_setup_cron

Anonymous

Cron Scripts

Introduction

  • YFi Hotspot Manager require a few scripts to run periodically in order to maintain a healthy and working system.

  • This section will discuss each of the Cron scripts involved and how to configure the server to run them via the Cron system.

  • Most of the scripts are CakePHP shell scripts. This makes it easy to interact with the MySQL database used by FreeRADIUS.


Activate Scripts

  • To activate the cron scripts execute the following command, which will add YFi Hotspot Manager's crons scripts to the Cron system

For Apache

sudo cp /var/www/c2/yfi_cake/setup/cron/yfi /etc/cron.d/

For Nginx

sudo cp /usr/share/nginx/www/c2/yfi_cake/setup/cron/yfi /etc/cron.d/
  • If you want to change the default intervals at which the scripts gets executed, just edit the /etc/cron.d/yfi file.

Location of cron scripts

  • It may happen that the CakePHP application (yfi_cake) is not installed in the default place as per this instructions. Should this be the case please update the /etc/cron.d/yfi file accordingly to reflect the correct paths.
    If you fail to comply to this, you will end up with a mis-configured, ill behaving YFi Hotspot Manager

Congratulations! Your YFi Hotspot Manager setup is complete.

The rest of this page will inform you more about each cron script.


Monitor the NAS Devices

  • After creating a NAS device you can edit it and specify if it should be monitored. It is monitored by default.
  • This will cause the monitor script to ping the specified device at intervals stipulated in the /etc/cron.d/yfi file.
  • The script only record state changes, keeping the data associated with the device small.
  • When showing a list of NAS devices you can see with a single glance which devices are available and which are down.
  • There is also an indication how long the device has been in the current state.
  • A view on the history of the NAS device's availability is also available.
  • This makes it easy to track problems with regards to power failures or suspect network connectivity.

Immediate indication

Imported from wikispaces

Availability history

Imported from wikispaces

Tweaking the script

Change the amount of ping packets that is send out by changing the value of 'ping_count' in the /var/www/c2/yfi_cake/config/yfi.php file.

$config['monitor']['ping_count']                    = 4;

Restart Checker

  • Some actions done on YFi Hotspot Manager requires the restart of the FreeRADIUS service.
  • When this happens the restart checker will automatically restart the FreeRADIUS service.
  • When the FreeRADIUS service restarts NAS devices can not make use of it's service.
  • To limit this impact we limit the intervals at which a restart may occur.
  • When the Restart Checker script restarted FreeRADIUS, it will not restart it again for the value specified in minutes in the /var/www/c2/yfi_cake/config/yfi.php file.

This is refered to as a 'back-off' interval.

  • You will also be notified on the tab of those actions that triggered a restart when it is waiting for the back-off interval to pass.
  • As of this writing the Nas Devices and Realms tabs include this behavior.
  • You can adjust the interval at which the tab checks for an 'Activate Changes' count down by adjusting the respective number spinner on each tab.
  • If you see a negative count-down value counting up, it is an indication that the cron script did not execute as desired.

Awaiting FreeRADIUS Restart

Imported from wikispaces


Voucher Clean-up

  • When YFi Hotspot Manager list vouchers there is a status column indicating state. (new, used, depleted, etc)
  • This script runs with two switches and at different intervals.
  • One checks for new account records and then determine if they belong to a voucher. If the voucher's state was new, it will be changed to used.
  • Another instance of this script runs less fequently.It goes through all the vouchers marked as used and try authenticate it to the FreeRADIUS server.

If authentication failed, it asumes the voucher is depleted and changes the voucher status accordingly.


Usage Notification

  • YFi Hotspot Manager offers the ability to inform permanent users of their cap's depletion.
  • You specify a method, a start value as well as an interval. If start value is 80, interval 10, the user will be notified when the cap is 80% used. The next inform messages will be on 90%,100%,110% etc.
  • The usage notification script runs periodically to see which users needs to be informed.

Specify usage notification

Imported from wikispaces


Month end

  • At the end of each month, the accounting detail of all permanent users needs to be closed - Much like bookkeeping.
  • The month end script terminates all active permanent user connections just before month end.
  • The month end script also clears all usage stats just after the new month cycle starts.
  • You specify when the end of the month should be. (Any day between the 1st and 28th)
  • To change the end of the month - change it in the '/var/www/c2/yfi_cake/config/yfi.php' AND '/usr/local/etc/raddb/rlm_perl_modules/conf/settings.conf' files. The default is the 1st.
  • The month end scripts runs every day but only do something on month end.

Related

Wiki: Home
Wiki: YfiTechNginx
Wiki: yfi_setup_pptpd