Linux Shell Scripting – An Introduction

Linux Shell Scripting

Scripts are collections of commands that are stored in a file. The shell can read this file and act on the commands as if they were typed at the keyboard. The shell also provides a variety of useful programming features to make your scripts truly powerful.

Write a simple shell script

Use an editor software to write the script. The following is the simplest “Hello World” program.

#!/bin/sh
# My first script
echo "Hello World!"

and save the above script to the file name “myScript.sh”

We can use any name for saving the script. but here I am using “.sh” extension for my script, since the shell used here is “/bin/sh”. Also it will help us to identify the scripts from a other files and folders.

Read more

How to check a website in a remote server before DNS change

In all migrations, we may wish to check the domain’s functionality and fix any errors preset  to make the dns change smoother and perfect. So just thought to add this in our blog too 🙂

Some control panel offer site preview, especially Plesk using which we can take a look on domain  hosted in that domain. But in others like cPanel, Directadmin and those without any control panels, we may need to check this using  local hosts file or by changing the A record on a temporary basis.

Best method is to check websites using your local “hosts” file in your PC / Laptop. Below is the steps using which one can test a website hosted in a remote server without changing the name server.

For Windows

1.  Locate the hosts file in your computer. Typically it is in one of the following locations:

Windows NT/2000/XP/2003/Vista/7   —     C:\windows\system32\drivers\etc\hosts
Windows 95/98/Me                                         —     C:\windows\hosts

Read more

kernel: LVE: Can’t enter to lve from slave context

These kind of error can be seen in /var/log/messages in a cpanel cloudlinux based server which will be filling the /var/log/messages quickly.

This can be caused due to below reasons :

1. You are running php as CGI and if that is the case, you can ignore this error and you can get this fixed by simply upgrading to the latest LVE kernel.

2. This happens due to conflict between mod_hostinglimits and mod_fcgid . In such cases, try disabling the mod_hostinglimits and see if that resolves the issue. If it fixes the issue, then

Edit “/usr/local/apache/conf/modhostinglimits.conf” and remove the handlers which are handled by mod_fcgid.

(I simply commented the AllowedHandlers line completely which stopped those errors)

Read more