Solved: How to schedule a cron job in Linux or Solaris

In this post we will see what’s a cron job and how we can set it.
Cron is managed by a crontab file. Its a configuration file in which we can schedule shell command to run periodically.
Scheduling cron
For modifying a cron you use a utility called crontab .
Before you can execute any crontab command you will have to set environment variables by executing below commands in your linux or unix command prompt.
TERM=vt100
EDITOR=vi
export TERM
export EDITOR
Now let’s see the different crontab commands.
Display current cron jobs
crontab -l
Edit cron file
crontab -e
Remove cron file (Be extremely careful with this command)
crontab -r
Cron format
You have to follow a specific format to schedule a cron job. See e.g. below:
30 22 * * 6 /home/cldvds/scripts/backup.sh
Let’s learn more about the asterisk (*) .
*       *        *        *         *        /file_execute.sh
–       –        –        –        –
|        |         |        |         |
|        |         |        |        +—– day of week (0 – 6) (Sunday=0)
|        |         |       +——- month (1 – 12)
|        |        +——— day of month (1 – 31)
|       +———– hour (0 – 23)
+————– min (0 – 59)
From the table above we can interpret that the  cron job will execute backup.sh file at 22:30 every saturday
Let’s take a few more examples
Execute every 5 mins
*/5 * * * *    /home/cldvds/scripts/backup.sh
Execute every hour
0 * * * *     /home/cldvds/scripts/backup.sh
Execute in every 3 hours
0 */3 * * *    /home/cldvds/scripts/backup.sh
Execute every Sunday at 1 am
0 1 * * 0    /home/cldvds/scripts/backup.sh
Tip:-
What if you want the cron to run at 22:30:30 i.e exact to seconds.
In such case at the start of your shell script put a sleep command as below
sleep 30
So, now the script will wait for 30 secs before executing.
Log redirection
30 22 * * 6 /home/cldvds/scripts/backup.sh >> /home/cldvds/scripts/logs.txt 2>&1
With the above command stderr (standard error) and stdout (standard output) will go to your logs.txt file.
Saving a cron file
Once you are done with cron schedule modification don’t forget to save the file.
You can save the file using standard save method of vi editor. The command sequence to save is  Esc :wq!

Solved: How to get Provisional Interest Certificate for housing loanfrom PNB (Punjab National Bank)

You can get the Provisional Interest Certificate from Punjab National bank both offline and online. Below we will discuss the process of both the methods.

Online method:-
You can get the Provisional Interest Certificate online. For this you will have to login to the internet banking of Punjab National bank. Below we will show you the steps involved.
  • Once you login to PNB internet banking. Click on Manage Accounts. Under the E-Interest Certificates select Housing Loan.


  • It will ask you to select the account number for which you need Provisional Interest Certificate. Once you select  the account you can either download or email the Provisional Interest Certificate.

Offline method:-
  • To get the Provisional Interest Certificate offline you will have to visit the branch from which your home loan is disbursed. But this can be a problem if you have shifted to another city.
  • If you cannot visit the branch, you can also try to get the certificate on mail. For this you will have to drop a mail to the email id of the branch from which you got loan. You may also have to make some follow-up calls. You can get the email id and contact number of branch from this link of PNB website. But, this may take time as some people in branch are not aware of this email facility and will simply tell you to visit the branch.
Best way to avoid any hassles is to follow online method discussed above.

Hope this helps. Do let us know if you have any query.

Solved: How to check remote port status in windows server 2016 without telnet



Telnet was always a security risk as data transfer is not secure on it. Seems like Microsoft has now finally removed it from Windows Server 2016.

We generally use telnet to check if a port is open on the remote server. So, how to check it now without telnet?

Instead of telnet you can use powershell commands to check the connections.

Please follow below steps for details.
Search for Windows powershell and open its console in your Windows 2016 server.
Use “Test-NetConnection ” command to check the port status. Let’s check if ports 3389 is open.

 Test-NetConnection 10.0.1.15 -port 3389

If port is open you will get output like below.

ComputerName : 10.0.1.15
RemoteAddress : 10.0.1.15
RemotePort: 3389
InterfaceAlias : Ethernet 3
SourceAddress :  10.0.1.37
TcpTestSucceeded : True

Else, you will get failed message. In the below example we can see that the ping reply succeeded as ICMP is allowed, but “TcpTestSucceeded” is false as remote port 3389 is not open.

WARNING: TCP connect to 20.0.1.18:3389 failed
ComputerName : 20.0.1.18
RemoteAddress : 20.0.1.18
RemotePort : 3389
InterfaceAlias : Ethernet 3
SourceAddress : 10.0.1.37
PingSucceeded : True
PingReplyDetails (RTT) : 147 ms
TcpTestSucceeded : False


Tip:- Read this post for checking port in Linux without telnet .

AWS CLI Elastic Beanstalk cheat sheet

In our last post we have seen how to use EB CLI for managing elastic beanstalk through command line.  But, you can also manage elastic beanstalk using traditional AWS CLI. In this post you will find  AWS CLI cheat sheet for the same.
If you are new to Elastic Beanstalk, it’s recommended that you go through this free AWS Elastic Beanstalk crash course.
Below are the major commands used frequently while managing the elastic beanstalk environment.
To check the availability of a CNAME
aws elasticbeanstalk check-dns-availability --cname-prefix my-cname
To create a new application
aws elasticbeanstalk create-application --application-name CldVdsApp --description "my application"
Compose Environments
 aws elasticbeanstalk compose-environments --application-name media-library --group-name dev --version-labels front-v1 worker-v1
To create a new environment for an application
The following command creates a new environment for version “v1” of a java application named “CldVdsApp”:
aws elasticbeanstalk create-environment --application-name CldVdsApp --environment-name my-env --cname-prefix CldVdsApp --version-label v1 --solution-stack-name "64bit Amazon Linux 2015.03 v2.0.0 running Tomcat 8 Java 8"
To specify a JSON file to define environment configuration options
The following create-environment command specifies that a JSON file with the name myoptions.jsonshould be used to override values obtained from the solution stack or the configuration template:
aws elasticbeanstalk create-environment --environment-name sample-env --application-name CldVdsApp --option-settings file://myoptions.json
To create a storage location
The following command creates a storage location in Amazon S3:
aws elasticbeanstalk create-storage-location
To abort a deployment
aws elasticbeanstalk abort-environment-update --environment-name my-env
To delete an application
The following command deletes an application named CldVdsApp:
aws elasticbeanstalk delete-application --application-name CldVdsApp
You can refer the complete set of AWS CLI for elastic beanstalk on this link.
Note:- All the above commands are taken from different AWS CLI reference guides and put in one place over here. Please run the commands after due diligence as we won’t be responsible for any mistakes in executing the commands and it’s consequences.  If you have any concern or query feel free to contact us or comment below.

Solved: Exceeded EC2 Instance Quota

You may face an error like “Exceeded EC2 Instance Quota” while you are trying to spin up new instances either standalone or in cluster.
This error is caused because you have hit the limit on number of instances allowed in your AWS account.
This limit is region and instance size specific. To get rid of this error you will have to request Amazon to increase the EC2 instance limit.
Requesting a limit increase is simple. Please follow below steps to know more.
  • Login to you AWS console and select EC2 from Services drop down.
  • Once in EC2 dashboard, in the left menu look for “Limits” and click on it.(refer image below)


  • Expand “Instance Limits” to see the limits in your account for each instance type. In our case we have limit of 5 on “r4.2xlarge instances” so we click on “Request limit Increase”.
  • You will get option to Create Case. Fill the details as in below image with a reason for requesting limit increase.

  • Once you submit the case, if your reason is good enough for Amazon they will increase the limit between couple of minutes to few hours.
You won’t be charged for increasing the limit but, only for instances that you spin up.