16.04 – How to edit a .odt file from the terminal?

The closest thing to what you’re looking for is wordgrinder, a terminal-based word processor.

You can install it executing:

sudo apt install wordgrinder

Here is the official website of the project: https://cowlark.com/wordgrinder/

This is the Github repo: https://github.com/davidgiven/wordgrinder

And a quick Survival Guide: https://gist.github.com/davidgiven/1aba97e96a9b8f9b573b

If you check the Importing and Exporting sections you will find:

Importing

Imports basic content from ODT files. OpenDocument is complicated and hard to parse but WordGrinder will do its best to apply appropriate styles. Unsupported features are ignored.

Exporting

This produces an ODT file which can be read by LibreOffice and a variety of other major word processors. Character and paragraph styles are exported and are mapped to OpenDocument styles called P, H1, H2 etc.

Source: 16.04 – How to edit a .odt file from the terminal? – Ask Ubuntu

16.04 – How to edit a .odt file from the terminal? was last modified: August 6th, 2020 by Jovan Stosic

NFS – Dovecot Wiki

NFS

NFS is commonly used in one of these ways:

  1. Dovecot is run in a single computer.
  2. Dovecot is run in multiple computers, users are redirected more or less randomly to different computers.
  3. Dovecot is run in multiple computers, each user is assigned a specific computer which is used whenever possible.

The only way to reliably implement the 2nd setup is with the director service.

Dovecot configuration

Single Dovecot server setup or Dovecot director cluster setup:

mmap_disable = yes
#dotlock_use_excl = no # only needed with NFSv2, NFSv3+ supports O_EXCL and it's faster
mail_fsync = always
mail_nfs_storage = no
mail_nfs_index = no

Multi-server setup that tries to flush NFS caches (increases NFS operations, and isn’t fully reliable), try not to use this:

mmap_disable = yes
#dotlock_use_excl = no # only needed with NFSv2, NFSv3+ supports O_EXCL and it's faster
mail_fsync = always
# These settings slow things down and don't fully work, use director proxy instead:
mail_nfs_storage = yes
mail_nfs_index = yes

Common issues

Clock synchronization

Run ntpd in the NFS server and all the NFS clients to make sure their clocks are synchronized. If the clocks are more than one second apart from each others and multiple computers access the same mailbox simultaneously, you may get errors.

NFS caching problems

NFS caching is a big problem when multiple computers are accessing the same mailbox simultaneously. The best fix for this is to prevent it from happening. Configure your setup so that a user always gets redirected to the same server (unless it’s down). This also means that mail deliveries must be done by the same server, or alternatively it shouldn’t update index files.

Dovecot flushes NFS caches when needed if you set mail_nfs_storage=yes, but unfortunately this doesn’t work 100%, so you can get random errors.

Disabling NFS attribute cache helps a lot in getting rid of caching related errors, but this makes the performance MUCH worse and increases the load on NFS server. This can usually be done by giving actimeo=0 or noac mount option.

Index files

If you keep the index files stored on NFS, you’ll need to set mmap_disable=yes. If you’re not running lockd you’ll have to set lock_method=dotlock, but this degrades performance. Note that some NFS installations have problems with lockd. If you’re beginning to get all kinds of locking related errors, try if the problems go away with dotlocking.

With mbox/Maildir formats (but not dbox!) it’s also possible to store index files on local disk instead of on NFS. If the user gets redirected to different servers, the local indexes are automatically created/updated. If the user is (nearly) always redirected to the same server this should be fine and you would likely get higher performance than indexes stored on NFS, but if the server changes it can be slow to recreate the index/cache files.

Source: NFS – Dovecot Wiki

NFS – Dovecot Wiki was last modified: June 30th, 2020 by Jovan Stosic

Configuring e-Mail Notifications in Nagios Core… 

Now that you have installed the required components to enabled Nagios to send mail notifications, you will need to download two configurations files from your Nagios Server (using FileZilla and edit them using Notepad++ – if you need to understand how to do this, please review part 2 of my installing Nagios for Exchange series).

These files are:

  1. commands.cfg
  2. contacts.cfg

Which are located in:

/usr/local/nagios/etc/objects

Open the commands.cfg file in Notepad++ and modify the following two lines:

# 'notify-host-by-email' command definition
define command{
    command_name    notify-host-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
    }

# 'notify-service-by-email' command definition
define command{
    command_name    notify-service-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
    }

To look like the following:

# 'notify-host-by-email' command definition
define command{
    command_name    notify-host-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
    }

# 'notify-service-by-email' command definition
define command{
    command_name    notify-service-by-email
    command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
    }

In essence you are changing the /bin/mail part of each command to /usr/bin/mailx

When you are done, save the file and then using FileZilla upload it back to your Nagios Server.

Next open the contacts.cfg file and change the “email” property to that of the account where you would like the notifications to be sent – see below

define contact{
        contact_name                    nagiosadmin        ; Short name of user
        use                                generic-contact        ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin        ; Full name of user
        email                           administrator@prepad.com    ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }

When you are done, save the file, and upload it back to your Nagios server.

To finish up the configuration, from a PuTTY session type in the following command:

sudo /etc/init.d/nagios restart

Source: Configuring e-Mail Notifications in Nagios Core… – telnetport25.com

Configuring e-Mail Notifications in Nagios Core…  was last modified: June 28th, 2020 by Jovan Stosic

Crontab Day of the Week syntax

0 and 7 both stand for Sunday, you can use the one you want, so writing 0-6 or 1-7 has the same result.

Also, as suggested by @Henrik, it is possible to replace numbers by shortened name of days, such as MON, THU, etc:

0 - Sun      Sunday
1 - Mon      Monday
2 - Tue      Tuesday
3 - Wed      Wednesday
4 - Thu      Thursday
5 - Fri      Friday
6 - Sat      Saturday
7 - Sun      Sunday

Graphically:

 ┌────────── minute (0 - 59)
 │ ┌──────── hour (0 - 23)
 │ │ ┌────── day of month (1 - 31)
 │ │ │ ┌──── month (1 - 12)
 │ │ │ │ ┌── day of week (0 - 6 => Sunday - Saturday, or
 │ │ │ │ │                1 - 7 => Monday - Sunday)
 ↓ ↓ ↓ ↓ ↓
 * * * * * command to be executed

Finally, if you want to specify day by day, you can separate days with commas, for example SUN,MON,THU will exectute the command only on sundays, mondays on thursdays.

https://stackoverflow.com/questions/18919151/crontab-day-of-the-week-syntax

Crontab Day of the Week syntax was last modified: May 23rd, 2020 by Jovan Stosic

How to see time stamps in bash history?

HISTTIMEFORMAT="%d/%m/%y %T "  # for e.g. “29/02/99 23:59:59”
HISTTIMEFORMAT="%F %T "        # for e.g. “1999-02-29 23:59:59”

To make the change permanent for the current user run:

echo 'HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc  # or respectively
echo 'HISTTIMEFORMAT="%F %T "' >> ~/.bashrc
source ~/.bashrc

To test the effects run:

history

https://askubuntu.com/questions/391082/how-to-see-time-stamps-in-bash-history

How to see time stamps in bash history? was last modified: May 23rd, 2020 by Jovan Stosic

Installing Document Server for Linux on Debian, Ubuntu and derivatives – ONLYOFFICE

Introduction

Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.

Functionality

  • Document Editor
  • Spreadsheet Editor
  • Presentation Editor
  • Documents application for iOS and Android
  • Collaborative editing
  • Hieroglyph support
  • Support for all the popular formats: DOC, DOCX, TXT, ODT, RTF, ODP, EPUB, ODS, XLS, XLSX, CSV, PPTX, HTML

This guide will show you how to install Document Server Linux version to your machine.

System requirements

  • CPU
    dual core 2 GHz or better
  • RAM
    2 GB or more
  • HDD
    at least 40 GB of free space
  • Additional requirements
    at least 4 GB of swap
  • OS
    64-bit DebianUbuntu or other compatible distribution with kernel version 3.13 or later
  • Additional requirements
    • PostgreSQL: version 9.1 or later
    • NGINX: version 1.3.13 or later
    • libstdc++6: version 4.8.4 or later
    • Redis
    • RabbitMQ

Installing Document Server

Installation with Debian based distributives also requires the presence of libstdc++6NGINX and PostgreSQL in the system.

All the necessary instrutions for these components and their dependencies installation can be found at their official websites.

There are other dependencies installed together with Document Server:

  • libcurl3
  • libxml2
  • supervisor
  • fonts-dejavu
  • fonts-liberation
  • ttf-mscorefonts-installer
  • fonts-crosextra-carlito
  • fonts-takao-gothic
  • fonts-opensymbol

These dependencies are installed automatically when you use Ubuntu 14.04 LTS or later. Earlier distributions might require their manual installation.

Installing dependencies

Document Server uses NGINX and PostgreSQL as database. Dependencies found in the system repository will be installed automatically at Document Server installation using the apt-get install command.

Installing and configuring PostgreSQL:

Install the PostgreSQL version included in your version of Ubuntu:

sudo apt-get install postgresql
If you want to install some other PostgreSQL version from the PostgreSQL Repository, please see the official PostgreSQL documentation for more detail on that.

After PostgreSQL is installed, create the PostgreSQL database and user:

The created database must have onlyoffice both for user and password.
sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice;"
sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
sudo -i -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"

Installing redis:

sudo apt-get install redis-server

Installing rabbitmq:

sudo apt-get install rabbitmq-server
Ubuntu distributives prior to 14.04 LTS might require some other dependencies to be installed.

Ubuntu 18.04 will require to install nginx-extras. This is done using the command:

sudo apt-get install nginx-extras
Changing the default Document Server port

By default Document Server listens to the incoming connections using port 80. Starting with version 4.3 you can change the port for Document Server if you plan to use it instead of the default one.

If you are going to change the default port, make sure that it is open for the incoming/outgoing connections. See the complete list of the ports used by Document Server.

To do that you will need to change the default port for the debconf system, running the command:

echo onlyoffice-documentserver onlyoffice/ds-port select <PORT_NUMBER> | sudo debconf-set-selections

Please write the port number instead of the <PORT_NUMBER> in the above command.

WarningIf you want to change the Document Server protocol to HTTPS, do not change the port to 443, but use this instruction instead.

There are additional options which can be used for Document Server installation. Please read this section for more information on them.

After that you can continue with Document Server installation.

Installing Document Server

Add GPG key:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5

Add Document Server repository:

sudo echo "deb https://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
While the APT package is built against Debian Squeeze, it is compatible with a number of Debian derivatives (including Ubuntu) which means you can use the same repository across all these distributions.

Update the package manager cache:

sudo apt-get update

Install Document Server

sudo apt-get install onlyoffice-documentserver
During the installation process, you will be asked to provide a password for the onlyoffice PostgreSQL user. Please enter the onlyoffice password that you have specified when configuring PostgreSQL.

After that Document Server will be run as a process. The package will be updated just like any other deb package.

Now you can connect Document Server to Community Server or integrate it into your own document management system using the provided API.

Running Document Server using HTTPS

In most cases accessing the portal via HTTPS protocol is much more secure than via HTTP which is used by default. You can easily run Document Server using secure connection. Please see the details here to learn more on how this can be done.

Additional information: more options for Document Server installation

The installation of Document Server allows the use of more debconf options which might be very helpful in case you plan installing it to more than one server or in some other cases.

These options include:

  • PostgreSQL database options
    • Set PostgreSQL database host address (replacing <DB_HOST> with the actual address of the PostgreSQL server installed):
      echo onlyoffice-documentserver onlyoffice/db-host string <DB_HOST> | sudo debconf-set-selections
    • Set PostgreSQL database user name (replacing <DB_USER> with the actual name of the user with the appropriate PostgreSQL database rights):
      echo onlyoffice-documentserver onlyoffice/db-user string <DB_USER> | sudo debconf-set-selections
    • Set PostgreSQL database user password (replacing <DB_PASSWORD> with the actual password of the user with the appropriate PostgreSQL database rights):
      echo onlyoffice-documentserver onlyoffice/db-pwd password <DB_PASSWORD> | debconf-set-selections
    • Set PostgreSQL database name (replacing <DB_NAME> with the actual PostgreSQL database name):
      echo onlyoffice-documentserver onlyoffice/db-name string <DB_NAME> | sudo debconf-set-selections
  • Redis options
    • Set Redis host address (replacing <REDIS_HOST> with the actual address of Redis installed):
      echo onlyoffice-documentserver onlyoffice/redis-host string <REDIS_HOST> | sudo debconf-set-selections
  • RabbitMQ options
    • Set RabbitMQ host address (replacing <RABBITMQ_HOST> with the actual address of RabbitMQ installed):
      echo onlyoffice-documentserver onlyoffice/rabbitmq-host string <RABBITMQ_HOST> | sudo debconf-set-selections
    • Set RabbitMQ user name (replacing <RABBITMQ_USER> with the actual name of the user with the appropriate RabbitMQ rights):
      echo onlyoffice-documentserver onlyoffice/rabbitmq-user string <RABBITMQ_USER> | sudo debconf-set-selections
    • Set RabbitMQ user password (replacing <RABBITMQ_PWD> with the actual password of the user with the appropriate RabbitMQ rights):
      echo onlyoffice-documentserver onlyoffice/rabbitmq-pwd password <RABBITMQ_PWD> | sudo debconf-set-selections

Source: Installing Document Server for Linux on Debian, Ubuntu and derivatives – ONLYOFFICE

Installing Document Server for Linux on Debian, Ubuntu and derivatives – ONLYOFFICE was last modified: April 24th, 2020 by Jovan Stosic

OpenLDAP N-Way MultiMaster Replication

dn: olcDatabase={1}hdb,cn=config
changetype: modify
add: olcSuffix
olcSuffix: dc=test,dc=local
-
add: olcRootDN
olcRootDN: cn=admin,dc=test,dc=local
-
add: olcRootPW
olcRootPW: {SSHA}SGq737yNactRCyMY70TDTQs6V1wzMRD6
-
add: olcSyncRepl
olcSyncRepl: rid=004 provider=ldap://ldap1.test.local binddn="cn=admin,dc=test,dc=local" bindmethod=simple
  credentials=test searchbase="dc=test,dc=local" type=refreshOnly
  interval=00:00:00:10 retry="5 5 300 5" timeout=1
olcSyncRepl: rid=005 provider=ldap://ldap2.test.local binddn="cn=admin,dc=test,dc=local" bindmethod=simple
  credentials=test searchbase="dc=test,dc=local" type=refreshOnly
  interval=00:00:00:10 retry="5 5 300 5" timeout=1
olcSyncRepl: rid=006 provider=ldap://ldap3.test.local binddn="cn=admin,dc=test,dc=local" bindmethod=simple
  credentials=test searchbase="dc=test,dc=local" type=refreshOnly
  interval=00:00:00:10 retry="5 5 300 5" timeout=1
-
add: olcMirrorMode
olcMirrorMode: TRUE

Source: linuxlasse.net :: OpenLDAP N-Way MultiMaster Replication

OpenLDAP N-Way MultiMaster Replication was last modified: April 16th, 2020 by Jovan Stosic