New tpeap-1.4 for Omada Controller 3.0.2 (Linux)
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!