Monday, May 20, 2019

Linux CRONTAB

Hi,

In this post we will discuss about Linux CRONTAB.

To put in short, the Crontab is a scheduler program or simply a program which executes an other program/command at a specified frequency.

Then general format of the Crontab would be as follows...
> crontab -e
the above command would open up crontab in a edit mode and the entries would take the general format as follows
* * * * * < program/command to be executed >
Let us discuss the asterisks as part of the command in detail...

From the left
MINUTE
The first asterisks(*) is a place holder for minutes i.e from 0 - 59

if the program/command to be executed at the start of 10 minute of every hour then the crontab entry would be like
10 * * * * < program/command to be executed >

HOUR
The second asterisks(*) is a place holder for hours i.e from 0 - 23

In case if you want your program to be executed at the start of every minute of the fifth hour then the entry would be
* 5 * * * < program/command to be executed >

DAY_OF_MONTH
The third asterisks(*) is a place holder for day of month i.e from 1 - 31

if you want your program to be executed only on first day of every month and on every minute then the crontab entry would be as follows...
* * 1 * * < program/command to be executed >

MONTH
The fourth asterisks(*) is a place holder for month, just like day of the week it is also represented with numbers

1 - January
2 - February
3 - March
4 - April
5 - May
6 - June
7 - July
8 - August
9 - September
10 - October
11 - November
12 - December

if you want your program to be executed only in sundays in january and at the start of every minute, then the crontab entry would be as follows.
* * * 1 0 < program/command to be executed >

DAY_OF_THE_WEEK
The fifth asterisks(*) is a place holder for day of the week i.e from Sunday - Saturday, normally the days of the week is represented as numbers, like ...

0 - Sunday
1 - Monday
2 - Tuesday
3 - Wednesday
4 - Thursday
5 - Friday
6 - Saturday

So if you want your program to execute only on sunday then the entry in the crontab would be as follows
* * * * 0 < program/command to be executed >
the key thing to look at form the above command is, the program/command would be executed at the start of every minute on sunday alone.


.
.
.
.
.

if you want your program to run every minute on all days, all weeks, all months then the entry would be as follow...
* * * * * < program/command to be executed >

Wednesday, May 15, 2019

Resetting a local branch to its HEAD version in GIT

Hi,

In this blog we are going to see how to reset a local branch to its HEAD version.

This is going to be a very short post and hope you like it

The format of the command to RESET a branch is given below
> git reset --hard <branch-name>

Assuming you have branch named "feature/registration", then the above command would be something like the one given below...
> git reset --hard feature/registration
If the execution is successful then you would see a message as mentioned below...

HEAD is now at <version> <commit-message>

How to change the root password in linux when it is forgotten/to change

This blog is all about changing the root password of the Linux system when it is forgotten or to reset the password...   Let's get it ...