Convert Text file into pdf on Linux command line

Create a small size pdf file from a text file

First install enscript on linux system.

apt-get install enscript

yum install enscript

Command to convert text file into pdf
enscript -B /path/of/text-file.txt -o - | ps2pdf - "/path/of/output.pdf"

-B is for not printing header on top of the pdf pages

Mongodb secondary database - database list and collection is not visible

MongoDB secondary replica does not have collections as in primary

Error : 
"$err" : "not master and slaveOk=false", "code" : 13435

Solution :
serverdb:SECONDARY> rs.slaveOk()

Running Command rs.slaveOk() on secondary instance is the solution.

Mysql installation conflict with mariadb

Error :
Renaming removed key_buffer and myisam-recover options (if present)

mysql_upgrade: Got error: 1524: Plugin 'unix_socket' is not loaded while connecting to the MySQL server

Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11

dpkg: error processing package mysql-server-5.7 (--configure):subprocess installed post-installation script returned error exit status 1

Errors were encountered while processing:mysql-server-5.7

Solution :
If you have installed MariaDB and then you have removed it to install mysql. This can be the cause of this issue. If you try to purge all old config filess and set everything up from scratch then it should work. 

Take Back up your important data before doing it.

# sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server
# sudo apt update 
# sudo apt dist-upgrade && sudo apt autoremove && sudo apt -f install
# sudo apt install mysql-server

Odoo - Remove Manage Databases link from Login page

Odoo - Remove Powered by Odoo Text from Login page

Edit file addons/web/views/webclient_templates.xml
sudo nano /opt/odoo/addons/web/views/webclient_templates.xml

Remove or Comment text "Manage Databases" and "Powered by Odoo".

Now you tried to restart the odoo server but you are not able to see your changes on the browser.

Here you need to load the web module because you ahve changed content in the file of web module. Without loading web module, you will not be able to see your changes. Restarting Odoo does not load the web module.

sudo -S su postgres -c "./odoo-bin start --update=web"

--update=all loads all modules but we need to reload only web module to see the changes. Now changes will be visible.

mysql - select query denied error

select command denied to user ''@'' for table ''

Solution :

You are getting this error because you are logged into the mysql user account where Select_priv is set as N for the user.

If you are able to modify your own privileges that is really good (Generally this can't be done because of security) otherwise you need to login with super user and need to set this privilege as Y.

Run this query :

update user set Select_priv = 'Y' where User = 'username';

Changes will not take effect after running this query. You will have to flush privileges.

Run Query :


After flushing privileges, if still you face denied error for select query, Log out from mysql, Log in again with same user and running select query again.
You will not get the error.

If you get same denied error for Insert, Update and Delete queries, you need to set them as Y using same method.

Restarting mysql does the job but every time you do not have command line access to restart it that's why you need to flush privileges.

Magento - No trailing slash appears after domain name

Magento - js/css/image files are not loading because no trailing slash appears after domain name

No trailing slash after domain makes all js/css/skin/media urls 404.

Solution :
Give trailing slash in domain name in column web/unsecure/base_url and web/secure/base_url of table  core_config_data.


Even if problem persists, login as admin.

Go to system > cache management
Flush all cache including 'flush magento cache' and 'flush cache storage'.

Now open site url. You should not get this issue.

Composer is getting stuck on installing dependencies

 php composer update stuck

Solution :

a) Download and Install updated composer

b) Use update command with verbose mode
composer -vvv update
It will display every single output and you will not be impatient.
Related Posts Plugin for WordPress, Blogger...