cronjob

To save result of a cronjob to a file, use

To list all cronjob, run

To edit all cronjobs, run

Disable cronjob output

To disable cronjob output, add following to end of the script

or

crontab
Start a program after reboot using cronjob
Running wp-cron with cronjob
Cronjob for Magento 1.9

Language

On Linux server if language is different, you can change it to English for current session by running

Example

See current language

List Available Languages

Change langauage

locale-gen

cut

Here is an example of cut command, that will remove all PHP packages from system

apt

List all Dependency for a package.

Errors

This web site allow you to generate /etc/apt/sources.list file for Ubuntu/Debian.

https://repogen.simplylinux.ch

This is helpful when you need to recreate your repo file.

Errors

apt fail after MariaDB to MySQL change

MySQL User

To allow a user to create another user

Now this user will be able to create new users.

Create a user with root privilages

For MySQL 8

Enable FCGI cache in Nginx

To enable fcgi cache in Nginx, add following code outside server block.

Inside your location for .php files, above the proxy_pass, add

Example

MongoDB

MongoDB is an Open Source NoSQL database.

https://www.mongodb.com/

Connecting to to MongoDB with user/pass

Install MongoDB

Free MongoDB hosting

Rsync backup with X days retention

rsync is run on backup server, that login to remote servers and backup.

Add following code

Repeat the rsync/echo lines for each server you need to backup.

We exclude some of the files from backup, this is specified in .rsync-exclude file.

Run it with cronjob

Backup Rotation

We rotate backup, so we have 20 days of backups. To do this, run cronjob

Create script

With following content

Here you need to add a folder for each server on line PATHES.

Here is content of excludes.txt

lvm

vgcreate

When i try mount a partition i get error

mount: unknown filesystem type ‘LVM2_member’

This is because the partition is LVM. Got it fixed with

Nginx WordPress

Here is nginx configuration for wordpress

Nginx Config with FCGI Cache + gzip compression