New tpeap-1.4 for Omada Controller 3.0.2 (Linux)

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.
12

New tpeap-1.4 for Omada Controller 3.0.2 (Linux)

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.
New tpeap-1.4 for Omada Controller 3.0.2 (Linux)
New tpeap-1.4 for Omada Controller 3.0.2 (Linux)
2018-08-24 16:50:07 - last edited 2021-03-30 03:46:53

Dear friends,

 

I have just finished work on tpeap 1.4, the start/stop script for Linux versions of Omada Controller 2.x and 3.x.

It's a complete re-work with many new options and functions. Please find the TAR archive attached to this post.

 

Installation

After extraction of the TAR archive you will find a directory tpeap-1.4 with the tpeap script, its manpage tpeap.man and two READMEs. To install the script and the manpage, just copy them into their destination directories.

 

Before doing so, make a backup of the old script:

 

    cp /opt/tplink/EAPController/bin/tpeap /opt/tplink/EAPController/bin/tpeap.ORIG

    cp /opt/tplink/EAPController/bin/portt /opt/tplink/EAPController/bin/portt.ORIG

 

Then install the script and its manpage:

 

    cp tpeap-1.4/tpeap /opt/tplink/EAPController/bin/

    cp tpeap-1.4/tpeap.man /usr/share/man/man8/tpeap.8

    gzip -fv --best /usr/share/man/man8/tpeap.8

 

Note that the exact location of the online manual might vary on your system. The portt helper utility is not needed anymore with tpeap.

 

If the new version of tpeap works for you, you can later remove the backup files tpeap.ORIG and portt.ORIG.

You can use tpeap 1.4 with all older versions of Omada/EAP Controller, but some commands (e.g. dump, restore) work only from v2.6.1 on.

 

Usage:

 

    tpeap [-hvwV] [-{W|S} sec] [-n nice] [-l {theme|version}] [-i file] command

 

 

Commands and options:

This are the available commands:

 

    start         starts the EAP Controller. See also options -w and -W.
    stop          stops the EAP Controller. See also option -w.
    restart       restarts the EAP Controller. Set option -w automatically.
    status        prints curent status of EAP Controller.
    dump [dir]    creates a dump of EAP Controller's database in 'dir'.
    restore [dir] restores a dump from 'dir' into EAP Controller's database.
    switch [ver]  switches EAP Controller from previous version to given version.
    theme [name]  selects theme 'name' of EAP Controller.

 

Options usually preceede commands, but tpeap is smart enough to recognize options specified after the command as well:

 

    -h           print this help message.
    -v           be verbose (prints startup messages).
    -w           wait for EAP Controller to become ready. See also option -W.
    -V           print version of tpeap and Omada Controller, then exit.
    -W sec       wait up to 'sec' seconds for EAP Controller to become ready.
    -S sec       save 'sec' as default wait time for option -w and exit.
    -n nice      set the nice value for Omada Controller (range -19 to 20).
    -l themes    list all installed themes for EAP Controller and exit.
    -l versions  list all installed versions of EAP Controller and exit.    
    -i file      install given file as a new theme for EAP Controller and exit.

 

 

What's new at a glance:

 

✱ Command »start« now shows the time needed to start Omada Controller synchronously (-w) on a given platform:

 

    # tpeap -w start
    [ ok ] Starting Omada Controller:............................................
    Omada Controller started successfully after 43 seconds.
    Direct your browser to http://ms.rag.lan:8088 for accessing the Omada Controller.
    #

 

✱ Startup messages are written to logfile »logs/startup.log« as usual. Use option -v (verbose) to print them on stdout instead.

 

✱ With option -S sec the script saves the time-out for synchronous starts permanently and exits. If you found the minimum value for the time-out on a given platform with -W sec, you now can save this value permanently with -S.

 

Note that the time needed to start Omada Controller can vary significantly depending on what needs to be done to set up the environment and also depending on the load of the server. For example, on a RasPi the very first start required ~143 seconds, while a normal start needs only ~98 seconds.

 

✱ Option -n nice lets you define a nice value for Omada Controller. Higher values mean lower scheduling priority, while lower values mean higher priority. The default nice value is now 10 starting with v3.0.2 of Omada Controller, while in previous versions the nice value was 0.

 

✱ Option -l {themes|versions} lists installed themes or installed versions of Omada Controller (argument can be abbreviated to t and v):

 

    # tpeap -l v
    Currently installed versions:
        EAPController version 2.4.7
        EAPController version 2.4.8
        EAPController version 2.5.3
        EAPController version 2.5.3beta
        EAPController version 2.6.1
        EAPController version 2.7.0
        EAPController version 3.0.2 (current)
    # 

 

You can switch between versions with the new »switch« command:

 

    # tpeap switch 2.7.0
    Switched to 'EAPController-2.7.0'. Now restart the Omada Controller to activate it.

    #

or:
    # tpeap switch EAPController-3.0.2
    Switched to 'EAPController-3.0.2'. Now restart the Omada Controller to activate it.
    #

 

Note that if you switch to another version, the tpeap script of this version will become active, which might not be the script you did install while another version was selected. Thus it's recommended to install tpeap 1.4 in all versions of Omada Controller present under /opt/tplink.

 

✱ Command »theme« lets you switch between different themes after they have been installed using option -i. A new theme for Omada Controller v2.7.0 has been published in a separate posting.

 

✱ Command »dump« lets you dump the database of Omada Controller into a directory (if none specified, it uses the directory »backup« in Omada Controller's home by default). This command also saves maps, portals and keystores. Messages are written to the log file »logs/backup.log« unless option -v is given, which causes all messages to be printed on stdout. To make a dump of the database, Omada Controller must be running (see the notes below):

 

    # tpeap dump /tmp/backup-20180824
    Creating backup directory '/tmp/backup-20180824'
    Dumping database into '/tmp/backup-20180824'
    #

 

✱ Command »restore« restores the database from a dump (if -v is given, even more messages are shown on stdout):

 

    # tpeap restore /tmp/backup-20180824/
    Restoring database from dump in '/tmp/backup-20180824/'
    connected to: 127.0.0.1
    1219 objects found
    11 objects found
    1 objects found
    8 objects found

       [more output omitted...]

    #

 

 

Some notes about database dumps:


— Dumps from v2.7.0 and v2.6.1 can be restored in newer versions of Omada Controller (e.g. v3.0.2) as long as you use the official mongodb package rather than the mongodb embedded in older versions of EAP Controller (v2.4.x, v2.5.3). That's why you always should use the official mongodb package from your system's repository.

 

— Dumping the database can be scripted and scheduled using a cron(8) job. This means that you can create dumps even remotely using ssh(1).

 

— If you need to dump single collections only, see mongodump(1) and mongorestore(1). tpeap does not support passing options to them, so it will always dump the whole database.

 

— If you restore a database, tpeap will drop existing collections before restoring the backup. This is needed to avoid inconsistences in the database.

 

— Omada Controller must be running if a database is being dumped. That's not ideal, because the snapshot of the database can change during the dump, but since Omada Controller insists to start and stop the mongodb daemon for itself rather than using the stand-alone mongodb, you have no choice at all. I wish TP-Link would remove the checks for a process already listening on the mongodb port 27017 in the Java source code, so we would be able to configure Omada Controller using properties to use a stand-alone mongodb started on system boot. This would not only make backups much more fool-proof, but would allow replication of the database and – most important – the use of mongodb for other applications, too.

 

 

Hope you like the new version of tpeap, enjoy!

 

And please give a Kudo to every Linux-related post from any user in this forum to show that there are more professional Linux users than Windows users, at least when it comes to server and Internet applications. UNIX / Linux rules the Internet since five decades now and IMHO it is an anachronism that TP-Link still gives Windows priority in its SMB application software! 

 

File:
tpeap-1.4.tar.gzDownload
༺ 0100 1101 0010 10ཏ1 0010 0110 1010 1110 ༻
  3      
  3      
#1
Options
12 Reply
Re:New version of tpeap for Omada Controller
2018-08-24 18:22:40

*snif snif* works so beautiful!!! thanks R1D2 !!!

  1  
  1  
#2
Options
Re:Re:New version of tpeap for Omada Controller
2018-08-24 20:55:05

Glad you like it! smiley

༺ 0100 1101 0010 10ཏ1 0010 0110 1010 1110 ༻
  0  
  0  
#3
Options
Re:New version of tpeap for Omada Controller
2018-08-25 11:16:07

Works great.

Thanks,
E-raser

  1  
  1  
#4
Options
Re: New version of tpeap for Omada Controller
2018-08-25 12:33:59

Thanks for feedback, E-raser. Just have added the new script to the TAR archive of Omada Controller 3.0.2.

༺ 0100 1101 0010 10ཏ1 0010 0110 1010 1110 ༻
  2  
  2  
#5
Options
Re:New tpeap-1.4 for Omada Controller 3.0.2 (Linux)
2018-09-11 14:42:50

Hello,

 

do you have any plans to make this script compatible with Centos?

 

Thank you

  0  
  0  
#6
Options
Re: New tpeap-1.4 for Omada Controller 3.0.2 (Linux)
2018-09-11 18:08:59

Hello lexam,

 

the software always takes care to run on every GNU Linux system, so if you could point out what's not working on RHEL-based CentOS, I can change the code. As for future versions coming as a .deb package I will add at least a TAR archive, too. Maybe I can also make a RPM package, but this would require to set up a RHEL or CentOS system first.

 

Did you download and try the tpeap-1.4 package with the v2.7.0 or v3.0.2 community version already?

 

༺ 0100 1101 0010 10ཏ1 0010 0110 1010 1110 ༻
  0  
  0  
#7
Options
Re:Re: New tpeap-1.4 for Omada Controller 3.0.2 (Linux)
2018-09-12 05:44:11 - last edited 2018-09-12 05:47:50

Hi R1D2,

 

I've been running EAP controller on Centos 7. The latest version of the tpeap script (v.1.4 from the relevant thread in here) seems to be using some init scripts, which are supposed to be generic, but as it turns out are not fully supported under Centos 7. For instance, the command start-stop-daemon doesn't seem to be available. The same goes for log_daemon_msg, log_end_msg and get_lsb_header_val, but I've been able to put a workaround for these in place. The start-stop-daemon though is a show stopper for me.

 

Thank you

  0  
  0  
#8
Options
Re: New tpeap-1.4 for Omada Controller 3.0.2 (Linux)
2018-09-12 11:02:03

lexam wrote

For instance, the command start-stop-daemon doesn't seem to be available. The same goes for log_daemon_msg, log_end_msg and get_lsb_header_val, but I've been able to put a workaround for these in place. The start-stop-daemon though is a show stopper for me.

 

I see. While start-stop-daemon is part of the dpkg package, the log_* functions are from the Linux Standard Base (LSB), which is a standard to make Linux distributions more portable. Did you try Redhat-lsb-core? If the log_* functions are not available in this package, they can be replaced by just an echo.

 

start-stop-daemon has been introduced in tpeap 1.2, it is used to start daemon processes with privilege separation. You could replace it by su. Either download tpeap-1.1.tar.gz from my FTP server (in /private/tpeap-1.1.tar.gz, not visible, but it's still there), or change the tpeap 1.4 to use su in this way:

 

  echo -n "Starting EAP Controller " 1>&2
  su $EAPC_USER -c "nohup $JAVA_TOOL $JAVA_OPTS -Deap.home=\"$EAPC_HOME\" -cp \"$JAVA_CLASSPATH\" \
                                     com.tp_link.eap.start.EapMain start >$EAPC_LOG/startup.log 2>&1 &"

for starting and:

 

  echo -n "Stopping EAP Controller "
  su $EAPC_USER -c "$JAVA_TOOL -Deap.home=\"$EAPC_HOME\" -cp \"$JAVA_CLASSPATH\" \
                               com.tp_link.eap.start.EapMain stop >>$EAPC_LOG/startup.log 2>&1 &"

 

for stopping EAPController. That's the most basic technique, it works on every UNIX system, even on MacOS and other BSDs.

 

tpeap 1.1 was actually the second version based on the first release from June 2017 and it was introduced when EAP Controller v2.5.3 for Linux appeared.

 

In Omada Controller 3.0.2 start-stop-daemon is replaced by jsvc, which does the same job in Java - uhm, nearly the same, it has been written by Java people sad.

 

start-stop-daemon is still there for compatibility with older community versions, but OmadaController 3.0.2 doesn't need it anymore.

 

Alternatively you could also try the daemon package from libslack.org to daemonize EAP Controller, but the soluton with su works too.

 

Which version of EAP Controller do you use?

༺ 0100 1101 0010 10ཏ1 0010 0110 1010 1110 ༻
  0  
  0  
#9
Options
Re:Re: New tpeap-1.4 for Omada Controller 3.0.2 (Linux)
2018-10-10 14:46:15
Hi R1D2, sorry for not getting back to you earlier. I ended up ditching Centos for my EAP controller and went with Ubuntu. So all works fine and as expected (thanks to you and your hard work). Cheers!
  0  
  0  
#10
Options
Re:Re:Re: New tpeap-1.4 for Omada Controller 3.0.2 (Linux)
2018-11-03 21:09:40

made it work on Centos6, testing!! 

  0  
  0  
#11
Options