Skip to main content

Playing with Crons

Before reading this page , I am assuming you are familiar with Linux . Just to recollect 
things crons are nothing but a scheduler 

Uses :

It is used to run a tasks at some predefined time OR we can say if want some task to get run at some time say 3 PM ,without requiring any manual work from us, then its comes very handy

For Freelance Work & Queries Contact me by Email Id support@linuxforeveryone.com

Crons User :
crons can be set using two types of users one is ROOT user and another is any normal user present on linux machine.

Server/Daemon :
       And crons in linux are managed by a server/daemon know as crond. If you are new to Linux
and want to learn about crons. let me tell you how to do that and to use crons for our daily tasks.

  
To set the crons using ROOT user
# crontab -l        (this will list crons of ROOT user if there is any present,like this below)


[root@master ~]# crontab -l
0 * * * * /etc/webmin/bandwidth/rotate.pl

Once you type above command you will find yourself in a editor ,mostly on vi editor (Editors are another topic which are not going to cover here)

Here IMP thing to understand the syntax of crons , which is as follows

** There are 6 coulmn in crons entries
** 1st coulmn --- >>  represent the Minute
** 2nd coulmn --- >> represent the hour
**3rd coulmn --- >> represent the Day of Month
**4th column --->> represent the Month
**5th column --->> represent Day of week
** 6th column --->> represent Command


Setting Up the crons now.

for this you need to run below command
#crontab -e             (this will invoke ROOT user cron list)

then we can set the cron as per our need , say for example , I want certain command to run every minute of every day and of every month of every day , then I will do this entry in crontab

* * * * * /bin/bash /root/test1.sh > test2.txt

Now, this command will direct the output of /root/test1.sh to the text file.

====================================X============X=================================================

Contact support@linuxforeveryone for any Freelancing work on Linux Servers

Subscribe my YouTube Channel 

Like My Facebook Page 

Browse the Best in class Web Hosting Plans


Comments

Popular posts from this blog

Multiple instances of redis

In the last post I have covered how to install redis server on Centos/Rhel using rpm method and yum method and some troubleshooting skills. In this post i am going to cover how to install and configure redis to run with multiple ports.                                                                           But why we need more ports ? If you have read my earlier post , you already know that by default redis runs on single port 6379, which any one can use it for small website to cache the data. But for heavy website like magento we need to use additional ports along with 6379 to serve different cache from different ports. Like in Magento there is simple cache which is normally stored under /var/cache directory. Then there is Full Page Cache which is stored under /var/full_page_cache...

arbtd: Package isn't signed with proper key

  If you are System Admin and worked on linux machine or servers in your current job or in past. Chances are you might come across linux service abrtd, even if you have not worked on it. but might be through some other work. same thing happened to me, while I was doing my regular work of installing php packages on linux  servers , i came across this error for which spent couple of hours actually to resolve it. T he error was 

Resolving IP SKU Requirements When Adding Azure VMs to Load Balancers

When it comes to configuring Azure Virtual Machines (VMs) within a Load Balancer (LB) environment, there are essential requirements that need to be addressed to ensure optimal performance and reliability. One common challenge faced by Azure users is the necessity of configuring IP SKUs correctly. In this blog post, we'll explore this requirement, its importance, and provide a solution to address it effectively. Understanding the IP SKU Requirement   The IP SKU (Service Key Update) requirement plays a pivotal role in the proper functioning of your Azure infrastructure, particularly within the context of Load Balancers. Here's what you need to know : IP Should Be in Standard SKU When adding Azure VMs to a Load Balancer, it's highly recommended to utilize public IP addresses configured with the Standard SKU. The Standard SKU offers an array of advanced capabilities, including enhanced traffic management and load balancing options. By using Standard SKU, you ensure a higher deg...