Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add BigCouch support #117

Open
wants to merge 3 commits into from

4 participants

Valentin Kuznetsov Diego Alan Malta Rodrigues ticoann
Valentin Kuznetsov
Collaborator

Please take changes for BigCouch back-end support in WMAgent. Upon previous request (PR#116) this PR contains changes as single commit. With this PR you may discard #116.

Valentin Kuznetsov vkuznet referenced this pull request
Closed

Wmagent bigcouch #116

Diego
Collaborator

Hi Valentin,

Did you have a chance to test it using the new set of scripts for wmagent that Alan sent you? I see you including its wmagent/deploy changes, but I don't see anywhere the wmagent_reorg file. Perhaps you forgot to include it?

Valentin Kuznetsov
Collaborator
Diego
Collaborator

The fact the manage_reorg file is there doesn't hurt anything. Also, you are already including the corresponding changes on wmagent/deploy...

Diego
Collaborator

Also, it is backward compatible with the current instructions AFAIR, otherwise it would not have worked for you: that is, the default variant defaults to what is in use currently and therefore the current wmagent instructions shall still work.

Valentin Kuznetsov
Collaborator
Valentin Kuznetsov
Collaborator
Diego
Collaborator

Then I don't understand you.... look at the wmagent/deploy file you committed (https://github.com/vkuznet/deployment/blob/5f63d242a9dc6697b1d5507ad2cb20944430e204/wmagent/deploy). It has pieces of code for manage_reorg (and the variants). If the purpose was to separate wmagent reorganization from the bigcouch support, why did you include these changes?

If the wmagent/deploy file you committed is what you used, you certainly tested it with the current wmagent deploy instructions :-)

Valentin Kuznetsov
Collaborator
Diego
Collaborator

Hi Valentin,

I did significant changes to bigcouch.spec and the related deployment/bigcouch scripts after my review. Therefore, I think you need to regenerate this pull request for the wmagent to catch up with the latest changes. Could you do that ?

Valentin Kuznetsov
Collaborator
Diego
Collaborator

Hi Valentin,

No, I haven't tested on a cluster environment. It was difficult enough for making all the bits fall in the right place already for single-node. Let's do one step each time.

About the ports, I did the setup so that both CouchDB and BigCouch can co-exist on the same machine. I've actually deployed both on cmsweb-dev. CouchDB keeps using port 5984, while BigCouch will use 5985 (main port) and 5986 (the back door, or admin port). That is, I used the port range we already had allocated for couch. Besides that, the Distributed erlang will listen to connections on the port range 9100-9105.

What you need to do is to drop the couch files from deployment/wmagent/bigcouch. It will then bring bigcouch with the offsite configuration that is what wmagents were supposed to use. You don't need to copy config files over the bigcouch RPM area. All the bigcouch configuration is under deployment/bigcouch/.

Cheers,
Diego.

Valentin Kuznetsov
Collaborator
Alan Malta Rodrigues
Collaborator

Valentin, the bigcouch RPM was made available today in comp.pre only:
https://hypernews.cern.ch/HyperNews/CMS/get/webInterfaces/1210.html
I believe that's fine for your tests, no?. Thanks

Valentin Kuznetsov
Collaborator
Valentin Kuznetsov
Collaborator
Alan Malta Rodrigues
Collaborator

If we add this dependency on wmagent.spec, then we are going to deploy every time both couch and bigcouch in the nodes, I don't think we want it. Couldn't you put this dependency on and build only private RPMs? At least now we have a bigcouch.spec to be used. If you can't, let me know and I'll make them available in my repo.

Valentin Kuznetsov
Collaborator
Diego
Collaborator

Hi Valentin,
You can use the "comp" meta-package to find out all CMS COMP dependencies, including bigcouch and wmagent. Besides, I think wmagent used to have it's own meta-package, "wmagent-dev" if I remember correctly. You could add bigcouch as a dependency there if you feel too annoying to have to build the full "comp" whenever you need to change some spec file. In general, building "comp" or "wmagent-dev" won't make much difference unless you changing things inner in the software stack.

Concerning the configuration files, you should not need ports.config because I put the corresponding configuration directly on vm.args. Besides vm.args and local.ini, the only config files that have an effect are those containing the secrets: the hmackey.ini and erlang.cookie file (see https://github.com/dmwm/deployment/blob/master/bigcouch/deploy#L56). If you want distributed erlang to work, all the nodes must have the same "erlang.cookie". The hmackey.ini only makes sense for applications running behind the cmsweb frontends, but that's not the case of wmagents.

Cheers,
Diego.

Valentin Kuznetsov
Collaborator

I am still confused with WMAgent/BigCouch deployment procedure. Originally I used deployment/Deploy script to install wmagent, see instructions here twiki:https://github.com/dmwm/WMCore/wiki/All-in-one-test. The configuration for BigCouch,CouchDB and MySQL were part of deployment/wmagent.

Now I was requested to drop bigcouch configuration from deployment/wmagent but I end-up with the following puzzle:

  • The Deploy script will deploy only cms packages, the WMAgent is cms package
  • If I add BigCouch as dependency to wmagent or wmagent-dev, it will be installed in comp/arch/external area. But the package will contain bare code, no configuration files.

My question is who should bring BigCouch configuration files from deployment/bigcouch area into release one (i.e. $root/current/config/bigcouch) and how/where this should be done.

The next question is how bigcouch will appear in $root/current/apps area? The Deploy script only make appropriate link for cms packages not externals and since wmagent installation does not use deployment/admin/InstallDev script (which can make those links as well) I don't know how bigcouch will appear under $root/current/apps area.

Finally, current deployment/wmagent/ area contains configuration files for mysql and couchdb which are copied into $root/current/config/{couchdb,mysql} areas, but Diego explicitly requested to drop bigcouch configuration from deployment/wmagent since now it resides in deployment/bigcouch area. This creates a precedent since deployment/wmagent will contain couchdb and mysql but bigcouch will reside elsewhere.

To sum-up, I think we're mixing different stuff here. The CouchDB and BigCouch are in deployment, but MySQL/ORACLE are not. The WMAgent needs configuration for all of them and right now it keeps then under its belt (they resides under deployment/wmagent area). If you ask to remove bigcouch config from deployment/wmagent, then I think CouchDB local.init configuration should follow the case. If we want to treat CouchDB/BigCouch as services, then we either need to modify Deploy script to allow their deployment independently from wmagent or move them from external into cms land (this will allow them to be installed via Deploy which will bring their configs in place). Bottom line, I'm puzzled with entire procedure and before making any action I rather prefer to get clear idea about all components.

Diego
Collaborator

Hi Valentin,

Most of this confusion would have been avoided if you had started with the new wmagent deployment script... but let's see if I can help you anyway.

The deployment/bigcouch scripts is the one to bring the bigcouch configuration. To get it in place, you need to put "deploy bigcouch offsite" on your wmagent/deploy script (in the deploy_wmagent_deps section). If it is not yet there on the default variant, you must put it as it is on the other mysql/oracle variants.

You can use pure Deploy script if you want (no InstallDev) to deploy any service. It doesn't matter if this is a CMS or external RPM. We never had a distinction and I don't know where this assumption came from.

Yes, since you are not using the new wmagent deploy scripts, your setup will have couchdb, mysql coming together in the wmagent configuration area, but bigcouch on a separate area.

If you coming to the O&C week, it is probably easier we meet and accomplish this together.

Cheers,
Diego.

Valentin Kuznetsov
Collaborator

Hi Diego, sorry I'm not going to C&O week, family issues. Therefore we need to work remotely.
My PR was based on new deployment script (at least I thought so and it was based on what Alan gave me from his private repo) and it does have deploy bigcouch offsite, see https://github.com/dmwm/deployment/pull/117/files#diff-250c1cdf491c9cb407e078aa445506f5R9

I did run pure Deploy script, but as I wrote it does not allow to use external packages, see https://github.com/dmwm/deployment/blob/master/Deploy#L53
and if I run it as

./Deploy -R bigcouch@<some tag>

it will not pick up bigcouch package since it is not in cms namespace. May be I'm missing something, please refer me to concrete example how to install external package via Deploy script.

So, I still need more info from you. Please have a look at PR files and clarify if wmagent/deploy script is new/old (if old please specify which one to pick up); if we'll use Deploy procedure I need to know details how to install external package; and I still need to clarify which prefix to use in deploy script to pick-up bigcouch from separate area.

Diego
Collaborator

Hi Valentin,

You have the new wmagent deploy scripts (except that you missing the manage_reorg file as we discussed before) but you still using the old "all-in-one" deployment instructions, which uses the "default" variant and therefore does not exercise the bits I added.

There is no restriction on being a CMS or external package. See for instance what we do to deploy mongodb since ever. It is an external, but gets deployed exactly as any other (CMS) service.

What you missing is that the "release" RPM you use on the Deploy -R option must depend on all the RPM packages needed, either directly or indirectly. This means that either you use "-R comp@" or use "-R wmagent-dev@" but add bigcouch RPM as a dependency on wmagent-dev.spec file.

Now you must make a choice: if you want to go with the "all-in-one" instructions, you need to add "deploy bigcouch offsite" to the default variant too, and hack things around on wmagent to start/stop/push things correctly to bigcouch (as it does for couchdb and mysql); if you want to go with the new deploy procedure, then you could deploy it with:

(VER=HG1404x REPO="-r comp=comp.pre" A=/data/cfg/admin; cd /data;  $A/InstallDev -R comp@$VER -S -s image -v $VER $REPO -p "wmagent/mysql")

(A=/data/cfg/admin; cd /data; $A/InstallDev -S -s start) # or stop, status...

Note the "-S" option to InstallDev commands. This is needed to run it on the single-user mode. If you prefer, you could still use the pure Deploy (prep, sw, post) commands to deploy it too.

Also note I'm deploying the mysql variant, not the default one. If you opt for the "oracle" variant instead, I think you must request the DB on devdb11 and deploy the schema too.

ticoann
Collaborator

Thanks Valentin and Diego for all the work.
I think we should go with the standard deployment (cmsweb) install of current all-in-one.
However, we first need to try and instruct all the parties which need to deploy the agents (ops, crab group, etc) and make sure whether all the task they do can be done. (since the manage script hasn't modified in terms of commands used, I guess it shouldn't be a problem)

What you missing is that the "release" RPM you use on the Deploy -R option must depend on all the RPM packages needed, either directly or indirectly. This means that either you use "-R comp@" or use "-R wmagent-dev@" but add bigcouch RPM as a dependency on wmagent-dev.spec file.

Diego, So we can't do wmagent@0.9.94c, but do we have to use wmagent-dev.spec (due to bigcouch dependency) to apply different version?

Diego
Collaborator

Hi Seangchan,
If you instead want to use wmagent@ver, you can. However, you add the dependency there instead of wmagent-dev. In practice, it doesn't make any difference. It will look a little bit weird, though, since you don't have code (library) dependencies on it, but a service dependency.

Cheers,
Diego.

ticoann
Collaborator

Hi Diego, It is not big deal. Normally, I don't think WMAgent can follow the same deployment schedule as cmsweb deployment. So I thought it would be cosmetically better to use wmagent.spec than wmagent-dev.spec.
Can wmagent be deployed along side with bigcouch? something like following?
Which might not be the better solution, though.

A=/data/cfg/admin; cd /data;  $A/InstallDev -R comp@$VER -S -s image -v $VER $REPO -p bigcouch wmagent@version
Diego
Collaborator

This has absolutely nothing to do with the cmsweb deployment schedule, this is software packaging and distribution.

You can use any package as the "release" reference package. It could be wmagent, wmagent-dev, wmtools, anything... you normally create a convenient meta-package and make it depend on all the services you'd like to deploy from the command line, including wmagent and bigcouch. However, you could instead just use the already existent "comp" meta-package if you don't want to create another one. Or put everything under the roof of the "wmagent" package, but for a newcomer trying to understand the wmagent business it would look like wmagent is using bigcouch as a library, which is not the case.

Concerning the question on deploying both services together.... yes, for sure you can. What you cannot do is deploy two variants of the same service at the same time (does not seem to make any sense). Agents must use the bigcouch/offsite variant, so either you remove bigcouch completely from your command line or, if you specify it, you specify "bigcouch/offsite" so that it is made consistent to what you depending on from inside the wmagent/deploy script.

And yes, you can specify the @version on the command line, but you don't need to if you just specify the right meta-package version.

For instance, you'd deploy with:
"""
A=/data/cfg/admin; cd /data; $A/InstallDev -R comp@HGXXXX-compX -S -s image -v $VER $REPO -p wmagent
"""
Where HGXXXX-compX is whatever version your private build of "comp" produced.

Or, depend on bigcouch from wmagent.spec and deploy it with:
"""
A=/data/cfg/admin; cd /data; $A/InstallDev -R wmagent@versionX -S -s image -v $VERX $REPO -p wmagent
"""

Where versionX is whatever you obtained when doing you new build of the wmagent package.

Did it help?

Diego
Collaborator

I had a look into it again and I don't have anything else to add. It is fine from my side.

I don't test wmagent myself, though, because currently it still has its own different set of installation instructions. However, Valentin said on private messages it worked for him, and provided the instructions used. I'm therefore going to merge this PR. Please update the all-in-one instructions if needed, otherwise it would break with normal wmagent operations.

ticoann
Collaborator

@geneguvo, Hi Diego, please hold off the the merge. I would like to discuss this ops and let them try the deployment first.

Diego
Collaborator

Sure. No problem. I'll wait until you give the green light.

ticoann
Collaborator

Thanks, Diego.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 1, 2014
  1. Valentin Kuznetsov

    Add BigCouch support

    vkuznet authored
Commits on Mar 28, 2014
  1. Valentin Kuznetsov

    New procedure

    vkuznet authored
  2. Valentin Kuznetsov

    Add manage_reorg

    vkuznet authored
This page is out of date. Refresh to see the latest.
Showing with 446 additions and 57 deletions.
  1. +86 −17 wmagent/deploy
  2. +160 −40 wmagent/manage
  3. +200 −0 wmagent/manage_reorg
103 wmagent/deploy
View
@@ -1,4 +1,18 @@
# vim: set ft=sh sw=2 ts=8 et :
+deploy_wmagent_variants="default mysql oracle"
+
+deploy_wmagent_deps()
+{
+ case $variant in
+ mysql | oracle )
+ deploy couchdb offsite
+ deploy bigcouch offsite
+ [ $variant = "oracle" ] || deploy mysql ;;
+ * )
+ deploy bigcouch offsite
+ ;;
+ esac
+}
deploy_wmagent_prep()
{
@@ -7,29 +21,84 @@ deploy_wmagent_prep()
deploy_wmagent_sw()
{
- deploy_pkg comp cms+wmagent
- # in old versions wmagent contains no code - get it from wmcore install
- [ -e $root/current/apps/wmagent/lib ] || deploy_pkg comp cms+wmcore
+ case $variant in
+ oracle | mysql )
+ deploy_pkg -a servicecert.pem -a servicekey.pem \
+ -a WMAgentSecrets.py:WMAgentSecrets-$variant.py \
+ comp cms+wmagent
+ ;;
+ * )
+ deploy_pkg comp cms+wmagent
+ # in old versions wmagent contains no code - get it from wmcore install
+ [ -e $root/current/apps/wmagent/lib ] || deploy_pkg comp cms+wmcore
- mkdir -p $root/current/install/wmagent
- mkdir -p $root/current/install/reqmgr
- mkdir -p $root/current/install/workqueue
- mkdir -p $root/current/install/mysql
- mkdir -p $root/current/install/couchdb
+ mkdir -p $root/current/install/wmagent
+ mkdir -p $root/current/install/reqmgr
+ mkdir -p $root/current/install/workqueue
+ mkdir -p $root/current/install/mysql
+ mkdir -p $root/current/install/couchdb
+ mkdir -p $root/current/install/bigcouch/logs
+ mkdir -p $root/current/config/reqmgr
+ mkdir -p $root/current/config/workqueue
- mkdir -p $root/current/config/reqmgr
- mkdir -p $root/current/config/workqueue
+ # couchdb deployment
+ local couchdb_ini=$root/current/config/wmagent/local.ini
+ local mysql_config=$root/current/config/wmagent/my.cnf
+ perl -p -i -e "s{deploy_project_root}{$root/current/install}g" $couchdb_ini
+ mkdir -p $root/current/config/couchdb
+ cp -f $couchdb_ini $root/current/config/couchdb
+ # mysql deployment
+ local mysql_config=$root/current/config/wmagent/my.cnf
+ mkdir -p $root/current/config/mysql
+ cp -f $mysql_config $root/current/config/mysql
+ ;;
+ esac
+}
- local couchdb_ini=$root/current/config/wmagent/local.ini
- local mysql_config=$root/current/config/wmagent/my.cnf
- perl -p -i -e "s{deploy_project_root}{$root/current/install}g" $couchdb_ini
+deploy_wmagent_post()
+{
+ case $variant in
+ mysql | oracle )
+ enable
- mkdir -p $root/current/config/couchdb
- cp -f $couchdb_ini $root/current/config/couchdb
- mkdir -p $root/current/config/mysql
- cp -f $mysql_config $root/current/config/mysql
+ # Tell mysql to deploy the schema on next start if not yet there
+ [ $variant = "oracle" ] ||
+ echo "$project_config/manage_reorg deployschema" \
+ > $root/state/mysql/stagingarea/wmagent
+ # Tell couchdb to push the wmagent couchapps on the next restart
+ echo "$project_config/manage_reorg pushcouchapp" \
+ > $root/state/couchdb/stagingarea/wmagent
+ (mkcrontab
+ # should instead just call sysboot when manage_reorg moves to manage
+ local cmd="$project_config/manage_reorg sysboot"
+ $nogroups || cmd="sudo -H -u _wmagent bashs -l -c \"${cmd}\""
+ echo "@reboot $cmd"
+
+ # Setup cronjob to reindex the views
+ # FIXME: to check if the reindex is still needed
+ # NOTE: increased from minutely to every 5 min
+ local cmd="$project_config/manage_reorg reindex"
+ $nogroups || cmd="sudo -H -u _wmagent bashs -l -c \"${cmd}\""
+ echo "*/5 * * * * $cmd") | crontab -
+ ;;
+ * ) ;;
+ esac
+}
+
+deploy_wmagent_auth()
+{
+ case $1 in
+ *cert.pem )
+ echo "replace me with your service certificate" ;;
+ *key.pem )
+ echo "replace me with your service key" ;;
+ *WMAgentSecrets-mysql.py )
+ echo 'databaseUrl = "mysql://root@localhost/wmagent"' ;;
+ *WMAgentSecrets-oracle.py )
+ echo 'databaseUrl = "oracle://DBUSER:DBPASSWORD@TNSNAME"' ;;
+ esac
}
200 wmagent/manage
View
@@ -1,6 +1,4 @@
#!/bin/bash
-
-
#
# Global variables etc
#
@@ -13,7 +11,9 @@ INSTALL_WQ="$ROOT_DIR/install/workqueue"
INSTALL_RM="$ROOT_DIR/install/reqmgr"
INSTALL_MYSQL="$ROOT_DIR/install/mysql"
INSTALL_COUCH="$ROOT_DIR/install/couchdb"
+INSTALL_BIGCOUCH="$ROOT_DIR/install/bigcouch"
+CONFIG_BIGCOUCH="$ROOT_DIR/config/bigcouch"
CONFIG_COUCH="$ROOT_DIR/config/couchdb"
CONFIG_MYSQL="$ROOT_DIR/config/mysql"
CONFIG_AG="$ROOT_DIR/config/wmagent"
@@ -51,6 +51,11 @@ COUCH_PORT=5984
COUCH_HOST_NAME=`hostname`
COUCH_CERT_FILE=
COUCH_KEY_FILE=
+COUCH_URL=
+
+BIGCOUCH=
+BIGCOUCH_HOST=127.0.0.1
+BIGCOUCH_PORT=5985
REQMGR_HOSTNAME=
REQMGR_PORT=8687
@@ -90,6 +95,7 @@ if [ -e $INSTALL_WQ/.init ]; then WQ_INIT_DONE=1; else WQ_INIT_DONE=0; fi;
if [ -e $INSTALL_RM/.init ]; then RM_INIT_DONE=1; else RM_INIT_DONE=0; fi;
if [ -e $INSTALL_MYSQL/.init ]; then MYSQL_INIT_DONE=1; else MYSQL_INIT_DONE=0; fi;
if [ -e $INSTALL_COUCH/.init ]; then COUCH_INIT_DONE=1; else COUCH_INIT_DONE=0; fi;
+if [ -e $INSTALL_BIGCOUCH/.init ]; then BIGCOUCH_INIT_DONE=1; else BIGCOUCH_INIT_DONE=0; fi;
#callbacks to activate or show initialisation has been done
activate_agent(){
@@ -122,6 +128,9 @@ inited_reqmgr(){
inited_couch(){
touch $INSTALL_COUCH/.init
}
+inited_bigcouch(){
+ touch $INSTALL_COUCH/.init
+}
inited_mysql(){
touch $INSTALL_MYSQL/.init
}
@@ -145,13 +154,18 @@ load_secrets_file(){
local MATCH_ORACLE_TNS=`cat $WMAGENT_SECRETS_LOCATION | grep ORACLE_TNS | sed s/ORACLE_TNS=//`
local MATCH_MYSQL_USER=`cat $WMAGENT_SECRETS_LOCATION | grep MYSQL_USER | sed s/MYSQL_USER=//`
local MATCH_MYSQL_PASS=`cat $WMAGENT_SECRETS_LOCATION | grep MYSQL_PASS | sed s/MYSQL_PASS=//`
- local MATCH_COUCH_USER=`cat $WMAGENT_SECRETS_LOCATION | grep COUCH_USER | sed s/COUCH_USER=//`
- local MATCH_COUCH_PASS=`cat $WMAGENT_SECRETS_LOCATION | grep COUCH_PASS | sed s/COUCH_PASS=//`
- local MATCH_COUCH_HOST=`cat $WMAGENT_SECRETS_LOCATION | grep COUCH_HOST | sed s/COUCH_HOST=//`
- local MATCH_COUCH_HOST_NAME=`cat $WMAGENT_SECRETS_LOCATION | grep COUCH_HOST_NAME | sed s/COUCH_HOST_NAME=//`
- local MATCH_COUCH_PORT=`cat $WMAGENT_SECRETS_LOCATION | grep COUCH_PORT | sed s/COUCH_PORT=//`
- local MATCH_COUCH_CERT_FILE=`cat $WMAGENT_SECRETS_LOCATION | grep COUCH_CERT_FILE | sed s/COUCH_CERT_FILE=//`
- local MATCH_COUCH_KEY_FILE=`cat $WMAGENT_SECRETS_LOCATION | grep COUCH_KEY_FILE | sed s/COUCH_KEY_FILE=//`
+
+ local MATCH_COUCH_USER=`cat $WMAGENT_SECRETS_LOCATION | grep ^COUCH_USER | sed s/COUCH_USER=//`
+ local MATCH_COUCH_PASS=`cat $WMAGENT_SECRETS_LOCATION | grep ^COUCH_PASS | sed s/COUCH_PASS=//`
+ local MATCH_COUCH_HOST=`cat $WMAGENT_SECRETS_LOCATION | grep ^COUCH_HOST | sed s/COUCH_HOST=//`
+ local MATCH_COUCH_HOST_NAME=`cat $WMAGENT_SECRETS_LOCATION | grep ^COUCH_HOST_NAME | sed s/COUCH_HOST_NAME=//`
+ local MATCH_COUCH_PORT=`cat $WMAGENT_SECRETS_LOCATION | grep ^COUCH_PORT | sed s/COUCH_PORT=//`
+ local MATCH_COUCH_CERT_FILE=`cat $WMAGENT_SECRETS_LOCATION | grep ^COUCH_CERT_FILE | sed s/COUCH_CERT_FILE=//`
+ local MATCH_COUCH_KEY_FILE=`cat $WMAGENT_SECRETS_LOCATION | grep ^COUCH_KEY_FILE | sed s/COUCH_KEY_FILE=//`
+
+ local MATCH_BIGCOUCH_HOST=`cat $WMAGENT_SECRETS_LOCATION | grep BIGCOUCH_HOST | sed s/BIGCOUCH_HOST=//`
+ local MATCH_BIGCOUCH_PORT=`cat $WMAGENT_SECRETS_LOCATION | grep BIGCOUCH_PORT | sed s/BIGCOUCH_PORT=//`
+
local MATCH_REQMGR_HOSTNAME=`cat $WMAGENT_SECRETS_LOCATION | grep REQMGR_HOSTNAME | sed s/REQMGR_HOSTNAME=//`
local MATCH_REQMGR_PORT=`cat $WMAGENT_SECRETS_LOCATION | grep REQMGR_PORT | sed s/REQMGR_PORT=//`
local MATCH_GLOBAL_WORKQUEUE_URL=`cat $WMAGENT_SECRETS_LOCATION | grep GLOBAL_WORKQUEUE_URL | sed s/GLOBAL_WORKQUEUE_URL=//`
@@ -194,8 +208,8 @@ load_secrets_file(){
COUCH_USER=${MATCH_COUCH_USER:-wmagentcouch};
COUCH_PASS=${MATCH_COUCH_PASS:-$COUCH_PASS};
if [ "x$COUCH_PASS" == "x" ]; then
- echo "Secrets file doesnt contain COUCH_PASS";
- exit 1
+ echo "### Secrets file doesnt contain COUCH_PASS";
+ #exit 1
fi
COUCH_PORT=${MATCH_COUCH_PORT:-$COUCH_PORT};
COUCH_HOST=${MATCH_COUCH_HOST:-$COUCH_HOST};
@@ -207,6 +221,17 @@ load_secrets_file(){
# if couch ssl key not specified check X509_USER_KEY and X509_USER_PROXY
COUCH_KEY_FILE=${MATCH_COUCH_KEY_FILE:-${X509_USER_KEY:-$X509_USER_PROXY}};
+ COUCH_URL="http://$COUCH_USER:$COUCH_PASS@$COUCH_HOST_NAME:$COUCH_PORT"
+
+ # Check BigCouch settings and if foudn swap COUCH attributes with BIGCOUCH ones
+ if [ -n "$MATCH_BIGCOUCH_HOST" ]; then
+ BIGCOUCH="1" # inform rest of the code that we'll use BigCouch
+ # basic bigcouch settings
+ BIGCOUCH_PORT=${MATCH_BIGCOUCH_PORT:-$BIGCOUCH_PORT};
+ BIGCOUCH_HOST=${MATCH_BIGCOUCH_HOST:-$BIGCOUCH_HOST};
+ COUCH_URL="http://$BIGCOUCH_HOST:$BIGCOUCH_PORT"
+ fi
+
REQMGR_HOSTNAME=${MATCH_REQMGR_HOSTNAME:-$REQMGR_HOSTNAME};
REQMGR_PORT=${MATCH_REQMGR_PORT:-$REQMGR_PORT};
@@ -227,25 +252,34 @@ load_secrets_file(){
WMBS_SERVICE_PORT=${MATCH_WMBS_SERVICE_PORT:-$WMBS_SERVICE_PORT};
WORKLOAD_SUMMARY_URL=${MATCH_WORKLOAD_SUMMARY_URL:-$WORKLOAD_SUMMARY_URL};
-
+ if [ "x$WORKLOAD_SUMMARY_URL" == "x" ]; then
+ WORKLOAD_SUMMARY_HOSTNAME=${MATCH_WORKLOAD_SUMMARY_HOSTNAME:-$WORKLOAD_SUMMARY_HOSTNAME};
+ WORKLOAD_SUMMARY_PORT=${MATCH_WORKLOAD_SUMMARY_PORT:-$WORKLOAD_SUMMARY_PORT};
+ WORKLOAD_SUMMARY_DBNAME=${MATCH_WORKLOAD_SUMMARY_DBNAME:-$WORKLOAD_SUMMARY_DBNAME};
+ #if WORKLOAD_SUMMARY_HOSTNAME is specified assume port and db name is specified too
+ if [ "x$WORKLOAD_SUMMARY_HOSTNAME" != "x" ]; then
+ WORKLOAD_SUMMARY_URL=http://$WORKLOAD_SUMMARY_HOSTNAME:$WORKLOAD_SUMMARY_PORT/$WORKLOAD_SUMMARY_DBNAME;
+ fi
+ fi
+ if [ ! "x$MATCH_WMSTATS_URL" == "x" ]; then
+ WMSTATS_URL=$MATCH_WMSTATS_URL;
+ fi
+
WMSTATS_URL=${MATCH_WMSTATS_URL:-$WMSTATS_URL}
-
REQMGR_URL=${MATCH_REQMGR_URL:-$REQMGR_URL}
-
ACDC_URL=${MATCH_ACDC_URL:-$ACDC_URL}
-
DBS3_URL=${MATCH_DBS3_URL:-$DBS3_URL}
-
PHEDEX_URL=${MATCH_PHEDEX_URL:-$PHEDEX_URL}
-
DQM_URL=${MATCH_DQM_URL:-$DQM_URL}
}
print_settings(){
+ load_secrets_file;
echo "INSTALL_AG= $INSTALL_AG "
echo "INSTALL_WQ= $INSTALL_WQ "
echo "INSTALL_RM= $INSTALL_RM "
echo "CONFIG_COUCH= $CONFIG_COUCH "
+ echo "CONFIG_BIGCOUCH= $CONFIG_BIGCOUCH "
echo "CONFIG_MYSQL= $CONFIG_MYSQL "
echo "CONFIG_AG= $CONFIG_AG "
echo "CONFIG_WQ= $CONFIG_WQ "
@@ -265,6 +299,9 @@ print_settings(){
echo "COUCH_PORT= $COUCH_PORT "
echo "COUCH_CERT_FILE= $COUCH_CERT_FILE "
echo "COUCH_KEY_FILE= $COUCH_KEY_FILE "
+ echo "COUCH_URL= $COUCH_URL "
+ echo "BIGCOUCH_HOST= $BIGCOUCH_HOST "
+ echo "BIGCOUCH_PORT= $BIGCOUCH_PORT "
echo "REQMGR_HOSTNAME= $REQMGR_HOSTNAME "
echo "REQMGR_PORT= $REQMGR_PORT "
echo "GLOBAL_WORKQUEUE_URL= $GLOBAL_WORKQUEUE_URL "
@@ -282,7 +319,7 @@ print_settings(){
echo "ACDC_URL= $ACDC_URL "
echo "DBS3_URL= $DBS3_URL "
echo "PHEDEX_URL= $PHEDEX_URL "
- echo "DQM_URL= $DQM_URL "
+ echo "DQM_URL= $DQM_URL "
}
@@ -300,7 +337,6 @@ export WMCORE_ROOT=${WMCORE_ROOT:-$WMAGENT_ROOT}
export YUI_ROOT
export COUCHSKEL_ROOT
-
#########################
# MySQL #
#########################
@@ -514,20 +550,22 @@ db_prompt(){
#
init_couch_pre(){
echo "Initialising CouchDB on $COUCH_HOST:$COUCH_PORT..."
- mkdir -p $INSTALL_COUCH/logs
- mkdir -p $INSTALL_COUCH/database
+ mkdir -p $INSTALL_COUCH/{certs,logs,database}
perl -p -i -e "s{deploy_project_root/couchdb}{$INSTALL_COUCH}" $CONFIG_COUCH/local.ini
# couch ini file requires IP based hostname
perl -p -i -e "s{bind_address = 0.0.0.0}{bind_address = $COUCH_HOST}g" $CONFIG_COUCH/local.ini
perl -p -i -e "s{port = 5984}{port = $COUCH_PORT}g" $CONFIG_COUCH/local.ini
perl -p -i -e "s{;admin = mysecretpassword}{$COUCH_USER = $COUCH_PASS}g" $CONFIG_COUCH/local.ini
if [ "x$COUCH_CERT_FILE" != "x" ] && [ "x$COUCH_KEY_FILE" != "x" ]; then
- mkdir -p $INSTALL_COUCH/certs
- perl -p -i -e "s{;cert_file =.*}{cert_file = $INSTALL_COUCH/certs/cert.pem}g" $CONFIG_COUCH/local.ini
- perl -p -i -e "s{;key_file =.*}{key_file = $INSTALL_COUCH/certs/key.pem}g" $CONFIG_COUCH/local.ini
- perl -p -i -e "s{;cacert_file =.*}{cacert_file = $INSTALL_COUCH/certs/cert.pem}g" $CONFIG_COUCH/local.ini
- ln -s $COUCH_CERT_FILE $INSTALL_COUCH/certs/cert.pem
- ln -s $COUCH_KEY_FILE $INSTALL_COUCH/certs/key.pem
+ perl -p -i -e "s{;cert_file =.*}{cert_file = $INSTALL_COUCH/certs/cert.pem}g" $CONFIG_COUCH/local.ini
+ perl -p -i -e "s{;key_file =.*}{key_file = $INSTALL_COUCH/certs/key.pem}g" $CONFIG_COUCH/local.ini
+ perl -p -i -e "s{;cacert_file =.*}{cacert_file = $INSTALL_COUCH/certs/cert.pem}g" $CONFIG_COUCH/local.ini
+ if [ ! -f "$INSTALL_COUCH/certs/cert.pem" ]; then
+ ln -s $COUCH_CERT_FILE $INSTALL_COUCH/certs/cert.pem
+ fi
+ if [ ! -f "$INSTALL_COUCH/certs/key.pem" ]; then
+ ln -s $COUCH_KEY_FILE $INSTALL_COUCH/certs/key.pem
+ fi
fi
}
@@ -549,7 +587,7 @@ status_of_couch(){
else
echo "++ Couch process not running"
fi
- echo "++" `curl -s $COUCH_HOST:$COUCH_PORT`
+ echo "++" `curl -s $COUCH_URL`
}
#
@@ -588,6 +626,68 @@ clean_couch(){
rm -rf $INSTALL_COUCH/database/*
}
+#########################
+# BigCouch #
+#########################
+
+init_bigcouch_post(){
+ inited_bigcouch;
+}
+
+create_bigcouch_dbs(){
+ load_secrets_file;
+ # create required databases
+ local bcadmin=""
+ for dbname in wmstats reqmgr; do
+ curl -X PUT "$COUCH_URL/$dbname?n=3&q=32"
+ done
+}
+
+status_of_bigcouch(){
+ $CONFIG_BIGCOUCH/manage status
+}
+
+start_bigcouch(){
+ load_secrets_file;
+ $CONFIG_BIGCOUCH/manage start "I did read documentation"
+ if [ $BIGCOUCH_INIT_DONE -eq 0 ]; then
+ echo "BigCouch has not been initialised... running post initialisation"
+ init_bigcouch_post;
+ fi
+}
+
+stop_bigcouch(){
+ $CONFIG_BIGCOUCH/manage stop "I did read documentation"
+}
+
+clean_bigcouch(){
+ echo "cleaning bigcouch installation..."
+ $CONFIG_BIGCOUCH/manage cleanviews "I did read documentation"
+ stop_bigcouch
+ echo "removing files"
+ rm -f $INSTALL_BIGCOUCH/.init
+ rm -rf $INSTALL_BIGCOUCH/database/*
+}
+
+#
+# couch wrappers to chooce either couch or bigcouch backend
+#
+start_couch_mgr(){
+ load_secrets_file;
+ if [ -n "$BIGCOUCH" ]; then
+ start_bigcouch;
+ else
+ start_couch;
+ fi
+}
+stop_couch_mgr(){
+ load_secrets_file;
+ if [ -n "$BIGCOUCH" ]; then
+ stop_bigcouch;
+ else
+ stop_couch;
+ fi
+}
#
# combined startup of all required services
@@ -596,7 +696,7 @@ start_services(){
load_secrets_file;
echo "Starting Services..."
#start up the services required by the agent
- start_couch;
+ start_couch_mgr;
if [ "x$MYSQL_USER" != "x" ]; then
start_mysql;
fi
@@ -606,7 +706,7 @@ stop_services(){
load_secrets_file;
#shut down all services
echo "Shutting down services..."
- stop_couch;
+ stop_couch_mgr;
if [ "x$MYSQL_USER" != "x" ]; then
stop_mysql;
fi
@@ -617,7 +717,6 @@ stop_services(){
##############################
-
# generate the agent config from the basic template
init_wmagent(){
load_secrets_file;
@@ -627,7 +726,7 @@ init_wmagent(){
--mysql_url=mysql://$MYSQL_USER:$MYSQL_PASS@localhost/$MYSQL_DATABASE_AG \
--mysql_socket=$INSTALL_MYSQL/logs/mysql.sock \
--working_dir=$INSTALL_AG \
- --couch_url=http://$COUCH_USER:$COUCH_PASS@$COUCH_HOST_NAME:$COUCH_PORT \
+ --couch_url=$COUCH_URL \
--global_workqueue_url=$GLOBAL_WORKQUEUE_URL \
--workqueue_db_name=$LOCAL_WORKQUEUE_DBNAME \
--wmbs_service_port=$WMBS_SERVICE_PORT \
@@ -638,13 +737,12 @@ init_wmagent(){
--dbs3_url=$DBS3_URL \
--phedex_url=$PHEDEX_URL \
--dqm_url=$DQM_URL
-
elif [ "x$ORACLE_USER" != "x" ]; then
wmagent-mod-config --input=$CONFIG_AG/config-template.py \
--output=$CONFIG_AG/config.py \
--coredb_url=oracle://$ORACLE_USER:$ORACLE_PASS@$ORACLE_TNS \
--working_dir=$INSTALL_AG \
- --couch_url=http://$COUCH_USER:$COUCH_PASS@$COUCH_HOST_NAME:$COUCH_PORT \
+ --couch_url=$COUCH_URL \
--global_workqueue_url=$GLOBAL_WORKQUEUE_URL \
--workqueue_db_name=$LOCAL_WORKQUEUE_DBNAME \
--wmbs_service_port=$WMBS_SERVICE_PORT \
@@ -676,7 +774,7 @@ init_reqmgr(){
--mysql_url=mysql://$MYSQL_USER:$MYSQL_PASS@localhost/$MYSQL_DATABASE_RM \
--mysql_socket=$INSTALL_MYSQL/logs/mysql.sock \
--working_dir=$INSTALL_RM \
- --couch_url=http://$COUCH_USER:$COUCH_PASS@$COUCH_HOST_NAME:$COUCH_PORT \
+ --couch_url=$COUCH_URL \
--reqmgr_port=$REQMGR_PORT \
--reqmgr_hostname=$REQMGR_HOSTNAME \
--workload_summary_url=$WORKLOAD_SUMMARY_URL \
@@ -686,7 +784,7 @@ init_reqmgr(){
--output=$CONFIG_RM/config.py \
--coredb_url=oracle://$ORACLE_USER:$ORACLE_PASS@$ORACLE_TNS \
--working_dir=$INSTALL_RM \
- --couch_url=http://$COUCH_USER:$COUCH_PASS@$COUCH_HOST_NAME:$COUCH_PORT \
+ --couch_url=$COUCH_URL \
--reqmgr_port=$REQMGR_PORT \
--reqmgr_hostname=$REQMGR_HOSTNAME \
--workload_summary_url=$WORKLOAD_SUMMARY_URL \
@@ -710,7 +808,7 @@ init_workqueue(){
--mysql_url=mysql://$MYSQL_USER:$MYSQL_PASS@localhost/$MYSQL_DATABASE_WQ \
--mysql_socket=$INSTALL_MYSQL/logs/mysql.sock \
--working_dir=$INSTALL_WQ \
- --couch_url=http://$COUCH_USER:$COUCH_PASS@$COUCH_HOST_NAME:$COUCH_PORT \
+ --couch_url=$COUCH_URL \
--reqmgr_port=$REQMGR_PORT \
--reqmgr_hostname=$REQMGR_HOSTNAME \
--workqueue_db_name=$GLOBAL_WORKQUEUE_DBNAME
@@ -719,7 +817,7 @@ init_workqueue(){
--output=$CONFIG_WQ/config.py \
--coredb_url=oracle://$ORACLE_USER:$ORACLE_PASS@$ORACLE_TNS \
--working_dir=$INSTALL_WQ \
- --couch_url=http://$COUCH_USER:$COUCH_PASS@$COUCH_HOST_NAME:$COUCH_PORT \
+ --couch_url=$COUCH_URL \
--reqmgr_port=$REQMGR_PORT \
--reqmgr_hostname=$REQMGR_HOSTNAME \
--workqueue_db_name=$GLOBAL_WORKQUEUE_DBNAME
@@ -857,7 +955,11 @@ clean_agent(){
status(){
load_secrets_file;
- status_of_couch;
+ if [ "$BIGCOUCH" ]; then
+ status_of_bigcouch;
+ else
+ status_of_couch;
+ fi
if [ "x$MYSQL_USER" != "x" ]; then
status_of_mysql;
fi
@@ -869,7 +971,11 @@ clean_all(){
if [ "x$MYSQL_USER" != "x" ]; then
clean_mysql;
fi
- clean_couch;
+ if [ "$BIGCOUCH" ]; then
+ clean_bigcouch;
+ else
+ clean_couch;
+ fi
clean_agent;
}
@@ -943,6 +1049,8 @@ case $1 in
start_services;;
stop-services)
stop_services;;
+ status-services)
+ status;;
start-mysql)
start_mysql;;
stop-mysql)
@@ -959,6 +1067,16 @@ case $1 in
stop_couch;;
clean-couch)
clean_couch;;
+ start-bigcouch)
+ start_bigcouch;;
+ stop-bigcouch)
+ stop_bigcouch;;
+ clean-bigcouch)
+ clean_bigcouch;;
+ status-bigcouch)
+ status_of_bigcouch;;
+ create-bigcouch-dbs)
+ create_bigcouch_dbs;;
init-agent)
init_agent;;
init-reqmgr)
@@ -983,6 +1101,8 @@ case $1 in
help ;;
version)
echo "Management script for WMAgent. No idea what version, at least 2 though" ;;
+ settings)
+ print_settings;;
* )
echo "$0: unknown action '$1', please try '$0 help' or documentation." 1>&2
exit 1 ;;
200 wmagent/manage_reorg
View
@@ -0,0 +1,200 @@
+#!/bin/sh
+
+##H Usage: manage_reorg ACTION [SECURITY-STRING]
+##H
+##H Available actions:
+##H help show this help
+##H version get current version of the service
+##H status show current service's status
+##H sysboot start server from crond if not running
+##H restart (re)start the service
+##H start (re)start the service
+##H stop stop the service
+##H deployschema deploy initial database schema
+##H destroyschema destroy everything in the database
+##H pushcouchapp push wmagent couchapps to couchdb
+##H reindex reindex the jobdump views
+##H
+##H For more details please refer to operations page:
+##H https://twiki.cern.ch/twiki/bin/view/CMS/WMAgentDeployment
+
+if [ $(id -un) = cmsweb ]; then
+ echo "ERROR: please use another account" 1>&2
+ exit 1
+fi
+
+ME=$(basename $(dirname $0))
+TOP=$(cd $(dirname $0)/../../.. && pwd)
+ROOT=$(cd $(dirname $0)/../.. && pwd)
+CFGDIR=$(dirname $0)
+AUTHDIR=$TOP/current/auth/$ME
+LOGDIR=$TOP/logs/$ME
+STATEDIR=$TOP/state/$ME
+COLOR_OK="\\033[0;32m"
+COLOR_WARN="\\033[0;31m"
+COLOR_NORMAL="\\033[0;39m"
+
+. $ROOT/apps/$ME/etc/profile.d/init.sh
+export PYTHONPATH=$ROOT/auth/$ME:$PYTHONPATH
+export WMAGENT_ROOT
+
+# Start service conditionally on crond restart.
+sysboot()
+{
+ if [ $(pgrep -u $(id -u) -f "config[=]$CFGDIR[/]WMAgentConfig.py" | wc -l) = 0 ]; then
+ stop # need to call stop on sysboot because wmagent may have left files
+ # laying around that will prevent it from starting correctly
+ start
+ fi
+}
+
+# Start the service.
+start()
+{
+ cd $STATEDIR
+ echo "starting $ME"
+
+ dburl=$(egrep -o "^databaseUrl.*=.*\".*\"" $AUTHDIR/WMAgentSecrets.py | cut -d\" -f2)
+ if [ ${dburl%%://*} = "mysql" ]; then
+ # Wait until the sock is created
+ n=0; while [ $n -le 40 -a ! -e $TOP/state/mysql/mysql.sock ]; do
+ echo "waiting for mysql..."; sleep 1; n=$(expr $n + 1)
+ done
+ [ -e $TOP/state/mysql/mysql.sock ] || \
+ { echo "Mysql not running. Not starting $ME."; exit 1; }
+ fi
+
+ wmcoreD --start --config=$CFGDIR/WMAgentConfig.py
+}
+
+# Stop the service.
+stop()
+{
+ echo "stopping $ME"
+ wmcoreD --shutdown --config=$CFGDIR/WMAgentConfig.py
+}
+
+# Check if the server is running.
+status()
+{
+ pid=$(pgrep -u $(id -u) -f "config[=]$CFGDIR[/]WMAgentConfig.py" | sort -n)
+ if [ X"$pid" = X ]; then
+ echo -e "$ME is ${COLOR_WARN}NOT RUNNING${COLOR_NORMAL}."
+ else
+ echo -e "$ME is ${COLOR_OK}RUNNING${COLOR_NORMAL}, PID" $pid
+ fi
+ wmcoreD --status --config=$CFGDIR/WMAgentConfig.py
+}
+
+# Verify the security string.
+check()
+{
+ CHECK=$(echo "$1" | md5sum | awk '{print $1}')
+ if [ $CHECK != 94e261a5a70785552d34a65068819993 ]; then
+ echo "$0: cannot complete operation, please check documentation." 1>&2
+ exit 2;
+ fi
+}
+
+# Main routine, perform action requested on command line.
+case ${1:-status} in
+ sysboot )
+ if ps -oargs= $PPID | grep -q crond; then
+ sysboot
+ else
+ echo "$0: sysboot is for cron only" 1>&2
+ exit 1
+ fi
+ ;;
+
+ start | restart )
+ check "$2"
+ stop
+ start
+ status
+ ;;
+
+ status )
+ status
+ ;;
+
+ stop )
+ check "$2"
+ stop
+ status
+ ;;
+
+ deployschema )
+ set -e
+ dburl=$(egrep -o "^databaseUrl.*=.*\".*\"" $AUTHDIR/WMAgentSecrets.py | cut -d\" -f2)
+ case ${dburl%%://*} in
+ mysql )
+ [ -n "$(mysql -u root --socket=$TOP/state/mysql/mysql.sock --exec \
+ "show databases like '${dburl##*/}'")" ] || {
+ mysql -u root --socket=$TOP/state/mysql/mysql.sock --exec \
+ "create database ${dburl##*/}"
+ # deploy the schema
+ wmcore-db-init --config $CFGDIR/WMAgentConfig.py --create \
+ --modules=WMCore.WMBS,WMCore.Agent.Database,WMComponent.DBS3Buffer,WMCore.BossAir,WMCore.ResourceControl
+ } ;;
+ oracle )
+ echo "Assuming the oracle database was already created by CERN/IT." ;;
+ * )
+ echo "Unrecognized DB dialect: \"${dburl%%://*}\". Make sure you" \
+ "specified a supported databaseUrl in $AUTHDIR/WMAgentSecrets.py."
+ exit 1 ;;
+ esac
+ ;;
+
+ destroyschema )
+ check "$2"
+ set -e
+ dburl=$(egrep -o "^databaseUrl.*=.*\".*\"" $AUTHDIR/WMAgentSecrets.py | cut -d\" -f2)
+ case ${dburl%%://*} in
+ mysql )
+ mysql -u root --socket=$TOP/state/mysql/mysql.sock --exec \
+ "drop database ${dburl##*/}" ;;
+ oracle )
+ echo "Don't have a procedure to destroy tables from oracle yet." ;;
+ * )
+ echo "Unrecognized DB dialect: \"${dburl%%://*}\". Make sure you" \
+ "specified a supported databaseUrl in $AUTHDIR/WMAgentSecrets.py."
+ exit 1 ;;
+ esac
+ ;;
+
+ pushcouchapp )
+ # Ugly hack because can only get admin role through localhost requests.
+ # FIXME: should instead change wmagent to use localhost for everything.
+ file=$(python -c 'import tempfile as t; print t.mkstemp(suffix = ".py")[1]')
+ cat $CFGDIR/WMAgentConfig.py > ${file}
+ perl -p -i -e 's{^localCouchURL = .*}{localCouchURL = "http://localhost:5984"}g' ${file}
+ export WMAGENT_CONFIG=${file}
+ export YUI_ROOT
+ wmagent-couchapp-init --skip-cron
+ rm -f ${file}
+ ;;
+
+ reindex )
+ # this came from wmagent-couchapp-init
+ # FIXME: to check if it is still needed
+ baseurl=$(python -c "from WMCore.Configuration import loadConfigurationFile;" \
+ "cfg = loadConfigurationFile('$CFGDIR/WMAgentConfig.py');" \
+ "print cfg.JobStateMachine.couchurl+'/'+cfg.JobStateMachine.couchDBName")
+ curl -ks -m 5 "$baseurl/fwjr/_design/JobDump/_view/statusByWorkflowName?limit=1" > /dev/null
+ curl -ks -m 5 "$baseurl/jobs/_design/FWJRDump/_view/outputByJobID?limit=1" > /dev/null
+ ;;
+
+ help )
+ perl -ne '/^##H/ && do { s/^##H ?//; print }' < $0
+ ;;
+
+ version )
+ echo "$WMAGENT_VERSION"
+ ;;
+
+ * )
+ echo "$0: unknown action '$1', please try '$0 help' or documentation." 1>&2
+ exit 1
+ ;;
+esac
Something went wrong with that request. Please try again.