Check if a directory exists in a shell script

Use the following conditions to check if a “directory exists” in a shell script if [ -d $DIRECTORY ] then rm -rf $DIRECTORY fi or if [ ! -d $DIRECTORY ] then mkdir $DIRECTORY Test case: Assume “testdir” is the file to check. The below script will check the file and if it exists, remove … More Check if a directory exists in a shell script

Crontab to Compress and Remove Old Messages Log with Ansible and GIT

Steps to be followed if we use GIT as our Version Control System with ansible repo. Assuming that my ansible repo is named as “ansible”. 1. Create local repo in github by clicking “Fork” in the master repo. 2. Clone local repo to your local directory:     git clone git@github.example.com:sree/ansible.git 3. In my local … More Crontab to Compress and Remove Old Messages Log with Ansible and GIT

How Does NGINX Work?

NGINX is built to offer low memory usage and high concurrency. Rather than creating new processes for each web request, NGINX uses an asynchronous, event-driven approach where requests are handled in a single thread. One master process can control multiple worker processes. The master maintains the worker processes, while the workers do the actual processing. All the … More How Does NGINX Work?

Apache MPMs (Multi Processing Modules)

Apache uses the following MPM (Multi-Processing Module) for handling incoming requests and processes them. Prefork Prefork MPM launches multiple child processes. Each child process handle one connection at a time. Worker Worker MPM generates multiple child processes similar to prefork. Each child process runs many threads. Each thread handles one connection at a time. Event … More Apache MPMs (Multi Processing Modules)

Major Built-in Variables in Linux

echo $HOME : Returns user home directory [sreevalsan256@instance-1 ~]$ echo $HOME /home/sreevalsan256 echo $PWD : Returns Current directory [sreevalsan256@instance-1 test]$ echo $PWD /home/sreevalsan256/test echo $MACHTYPE : Returns machine type [sreevalsan256@instance-1 test]$ echo $MACHTYPE x86_64-redhat-linux-gnu echo $HOSTNAME : Returns system name [sreevalsan256@instance-1 test]$ echo $HOSTNAME instance-1 echo $BASH_VERSION : Returns bash verison [sreevalsan256@instance-1 test]$ echo $BASH_VERSION … More Major Built-in Variables in Linux

Difference between cron and anacron

Both cron and anacron  can schedule execution of recurring tasks to a certain point in time defined by the user. Major differences are: cron gives minimum time set can be in minute while anacron gives it in days cron job can be scheduled by any normal user while Anacron can be scheduled only by the super user. cron expects the system to … More Difference between cron and anacron

Error while adding an Addon domain in cPanel (sorry the domain is already pointed to an IP address)

Error while adding Addon Domain in  cPanel: Sorry, the domain is already pointed to an IP address that does not appear to use DNS servers associated with this server. Please transfer the domain to this servers nameservers or have your administrator add one of its nameservers to /etc/ips.remotedns and make the proper A entries on … More Error while adding an Addon domain in cPanel (sorry the domain is already pointed to an IP address)