A customer asked me how to automate the process in adding, deleting website configuration in apache and the WebSphere plugin. Even wants to handle the Apache cache, because DISK Cache is enabled, when pages in the Domino website changes. Apache is running on Linux and Domino on Windows.

Now we are facing the problem how to send commands to the Linux server from the Domino ( Windows ) server and from the Windows Admin desktops?!

After a couple of hours i came up with the perfect remote solution and 3 scripts: clearcache.sh, createwebsite.sh and deletewebsite.sh

I use plink, ( Putty Link ) for sending commands to the Linux server for remote kicking and running the 3 scripts.

Plink.exe needs 4 parameters: <remote server> -l <user> -pw <password> <script or command and it’s parameters>

Initialize

  • Asume the Apache server is 10.0.0.1
    Asume the Domino servers are 10.0.0.10, 10.0.0.11 and 10.0.0.12 ( Domino01, Domino02 and Domino03 )
  • I created all scripts in /opt/scripts
  • I created a user called “runscript” with password “runscript123”
  • I changed the owner of the scripts
    chown runscript:runscript /opt/scripts/*.sh
  • I added sudo rights for the user “runscript’
    Create a file /etc/sudoers.d/websites and the following line in it:
    runscript    ALL=(ALL) NOPASSWD: ALL
    The user “runscript” can now use sudo and don’t have to enter a password on the remote script calls.
  • I introduced a seperate website.d folder for creating website conf files. Every website has it’s own file.
    /etc/httpd/websites.d/<websitename>.conf
  • I changed the httpd.conf to include the new structure
    IncludeOptional conf.d/*.conf
    IncludeOptional websites.d/*.conf
  • I changed the <website>.conf so every website has it’s own disk cache
    CacheRoot “/var/cache/mod_proxy/<websitename>/”
  • I changed the plugin-cfg.xml so we can automate the process of adding url’s into the 3 Domino servers
    plugin-cfg.xml is included in this blog.

 

clearcache.sh

This script can remove a single or multiple url’s, and even the entire website, from the apache disk cache.

syntax: plink 10.0.0.1 -l runscript -pw runscripts123 /opt/scripts/clearcache.sh <websitename> <searchstring>

The script will search through it’s cache in /var/cache/mod_proxy/<websitename> for the <searchstring> and removes it from the disk cache if found.

If you enter * as the <searchstring>, the script removes the entire cache for that website.

 

createwebsite.sh

This script does a couple of things: change plugin-cfg.xml, create a log folder, create a disk cache folder and create a website.conf file.

Syntax: plink 10.0.0.1 -l runscript -pw runscripts123 /opt/scripts/createwebsite.sh <websitename> <url> <dominoserver>

<dominoserver> is a hardcoded option which can only contain only the 3 domino servers. Other options are now allowed. The plugin-cfg.xml has been prepared for these options.

The last action in this script, is restarting the Apache service. ( not gracefully )

 

deletewebsite.sh

This script does a couple of things: change plugin-cfg.xml, removes the log folder, removes the disk cache folder and removes the website.conf file.

Syntax: plink 10.0.0.1 -l runscript -pw runscripts123 /opt/scripts/deletewebsite.sh <websitename> <url>

The last action in this script, is restarting the Apache service. ( not gracefully )

 

Link to download mentioned scripts and file: files

Visits: 397

By angioni

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.