Hey guys, welcome back. In this video we're gonna be discussing crontabs/cronjobs
and this is basically a way to schedule tasks to be run at certain
times. So, let's get right to it. How you're gonna get into the interface for
building crontabs, is typing "crontab -e" and this is gonna open a crontab file,
it's gonna be saved
the /etc directory, and I'm going to erase this. So, basically you can see on this
line right here the structure of the crontab. So, this is gonna be minutes 0-59,
hours 0-23, this is gonna be day of month so 1-31, month number which is
gonna be 1-12, and the day of week which is gonna be 0-6, and then the command
that you want to perform at that time. So, I'm gonna run a command on the 15th
minute, the 14th hour, regardless of the day of the month, regardless of the month,
regardless the day of the week, and the command that i'm gonna do is "ls"
and I'm going to output the command results to /home/nick/lt/cronres.txt
I think if I change this to 12, and then save, and exit it we will be
able to see this happen right away. So, let's go into this directory here, I'm maximizing.
So, it's now 2:12 and we're looking for cronres.txt. So, this process just ran and it
returned a list
of my home directory, and put it into this file. So, as you can see if we go back in there,
the reason it did that at this exact time is because on the 12th minute, of
the 14th hour, on every day of the month, every month of the year, and every day of
the week, this is performed. So, if I wanted this to run at 5 a.m. on Sundays, I would do this
5 a.m. every Sunday it would log this this "ls" command to cronres.txt.