-
Notifications
You must be signed in to change notification settings - Fork 0
Home
1 ... Project Description
2 ... AutoTools (configure and make) Installation
3 ... Ubuntu Installation
4 ... Debian and Raspbian Installation
The Server Wait On Clients (SWOC) system provides a mechanism for clients to register locks on a server which the server can then watch and wait until all locks are released before taking some action.
It is easier to show an example: Overnight, clients want to perform crontab work as a user and root, then do a backup and then shutdown enabling the server to initiate its own shutdown.
So an example root crontab on the client:-
This line adds a lock, performs some work of unknown duration and releases the lock.
10 00 * * 0,1,2,3,4,5,6 date ; swocclient -l ; apt-get update -qq ; \
apt-get upgrade -d -q -y ; apt-get dist-upgrade -d -q -y ; \
swocclient -r ; date
This line adds a lock of its own, waits until this client has one lock outstanding, ie its own, then performs a backup, releases the lock and shuts down.
15 00 * * 0,1,2,3,4,6 date ; swocclient -l ; swocclient -w1 ; date ; \
netbckup -d ; swocclient -r ; date ; at -f shutdown now
At the same time, a user crontab on the client is using two crontab entries to run some jobs each taking its own lock at the start and releasing it at the end. Both of these lines are of unknown and variable duration:-
10 00 * * 0,1,2,3,4,6 swocclient -l ; \
get_iplayer --pvr 2>/home/mgrant/Videos/iPlayer/VideosErr.log ; date ; \
swocclient -r
10 00 * * 0,1,2,3,4,6 swocclient -l ; \
mget --quiet --sourcefile /home/mgrant/Downloads/MultiGetSource.txt \
--targetdir /home/mgrant/Downloads ; date ; swocclient -r
Meanwhile on the server, it waits until it has no more registered locks and then initiates a shutdown.
20 00 * * 0,1,2,3,4,5,6 date ; swocserver -w ; date ; at -f shutdown now
This AutoTools project contains the entire Server Wait On Clients System.
Whilst this project can be treated as a single entity, (build, install, uninstall, etc), it is designed so that only the desired elements, the client parts, the server parts, or both, can be installed on a system. Indeed, by the time this system is packaged downstream, it is split into 9 packages although the user would only handle the client and / or server packages and the others would be installed as required as dependencies.
These individual elements are contained in 9 subdirectories of the project root and they are all AutoTools sub-projects in their own right. These sub-projects are:-
com-dev Development files for the common library libswoccommon.
com-lib The common library libswoccommon.
cli-dev Development files for the client library libswocclient.
cli-lib The client library libswocclient.
cli-prg The command line client program.
srv-dev Development files for the server library libswocserver.
srv-lib The server library libswocserver.
srv-prg The command line server program and the server daemon.
doc Doxygen documentation on the entire project.
The development files generally consist of c header files, pkg-config files and man pages.
This system depends on other libraries. Two definite requirements are libmgec and libmgesystutils. They can be found here:-
Any other dependencies not installed on your system will be identified by the configure script. Any of these produced by this author can be found in a repository located here:-
The Doxygen documentation can be viewed online at https://m-grant-prg.github.io/swoc/
At a source modification / development level, this project expects to reside in a git environment. This manifests itself in 3 places:-
- ... .gitignore files are included in the source.
- ... The make target, 'srctarball', relies on the command 'git am' so it will fail if git is not installed or it is not in a git repository.
- ... Package building for the full project relies on the command 'git describe' so it will fail if git is not installed or it is not in a git repository. (As said before, building the full package is not a particularly meaningful task.)
a) ... Download either the source or distribution tarball (the .tar.gz file) from:-
b) ... Extract the tarball preserving the directory structure.
c) ... cd to the directory created.
d) ... If you downloaded the source tarball type 'autoreconf -if'
e) ... Type './configure'
f) ... As root or sudo, type 'make install clean'
g) ... Edit the config files, please refer to the com-lib/README file and the srv-prg/README file. Both need to be followed.
(Quote marks are for textual clarity only).
To uninstall the package:
1 ... cd to the directory created in the above install process.
2 ... As root or sudo, type 'make uninstall clean'
This system is available as a series of Ubuntu packages hosted in a Personal Package Archive (PPA). If you add this PPA to your software sources then you can easily install, update and remove the packages.
To view the details of this PPA please follow the link below:-
To add this PPA to your system please type the following:-
sudo add-apt-repository ppa:m-grant-prg/utils
sudo apt-get update
All 9 sub-projects are available as packages with the proper dependencies set up, so each package can be addressed individually, however, most commonly only the top level packages will be handled. The packages are:-
libswoccommon-dev The development files for the common library.
libswoccommon-lib The common library libswoccommon.
libswocclient-dev The development files for the client library.
libswocclient-lib The client library libswocclient.
swocclient The command line client program.
libswocserver-dev The development files for the server library.
libswocserver-lib The server library libswocserver.
swocserver The command line server program and the server daemon.
swocdoc Doxygen documentation on the entire project.
To install the server package on your system please type the following:-
sudo apt-get update
sudo apt-get install swocserver
After installation please follow section "2 ... AutoTools (configure
and make) Installation" from item (g) onwards above.
To uninstall this package at any time please type:-
sudo apt-get remove swocserver
To install the client package on your system please type the following:-
sudo apt-get update
sudo apt-get install swocclient
After installation please follow section "2 ... AutoTools (configure
and make) Installation" from item (g) onwards as detailed in the
com-lib/README file.
To uninstall this package at any time please type:-
sudo apt-get remove swocclient
Debian and Raspbian packages can be installed from a repository hosted at Bintray:-
To add this repository to your system please type the following:-
sudo apt-get install software-properties-common apt-transport-https
sudo add-apt-repository 'deb https://dl.bintray.com/mgrantprg/utils stretch stable'
wget -qO - https://bintray.com/user/downloadSubjectPublicKey?username=mgrantprg | sudo apt-key add -
sudo apt-get update
All 9 sub-projects are available as packages with the proper dependencies set up, so each package can be addressed individually, however, most commonly only the top level packages will be handled. The packages are:-
libswoccommon-dev The development files for the common library.
libswoccommon-lib The common library libswoccommon.
libswocclient-dev The development files for the client library.
libswocclient-lib The client library libswocclient.
swocclient The command line client program.
libswocserver-dev The development files for the server library.
libswocserver-lib The server library libswocserver.
swocserver The command line server program and the server daemon.
swocdoc Doxygen documentation on the entire project.
To install the server package on your system please type the following:-
sudo apt-get update
sudo apt-get install swocserver
After installation please follow section "2 ... AutoTools (configure
and make) Installation" from item (g) onwards above.
To uninstall this package at any time please type:-
sudo apt-get remove swocserver
To install the client package on your system please type the following:-
sudo apt-get update
sudo apt-get install swocclient
After installation please follow section "2 ... AutoTools (configure
and make) Installation" from item (g) onwards as detailed in the
com-lib/README file.
To uninstall this package at any time please type:-
sudo apt-get remove swocclient