How to Create Cron Jobs on Linux

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi Emmanuel with t2s transform to succeed in this video I'm going to walk you through the steps on how you can use uh uh how you can schedule Crown jobs on a Linux operating system so this is what we will be uh looking at here so the goal the goal is to schedule ACR on job as user 30 to Echo this sentence hi I am learning about Crown jobs at every 27th minute past the hour between 900 a.m. and 11:00 a.m. on the 20 on the 10th and the 25th of every month and then we have to redu direct the output uh to the temp Chron do out file finally we will list the entry and then delete the Chown job that we will have created so without further Ado let's jump into our project to Day meaning I'm going to take you to my uh ter here and for this specific project I'm using uh Ubuntu I'm using Ubuntu here so here's what we we have to do first of all we have to make sure that that uh the user 30 that we want to use here specifically the desired user we want to use here uh does exist so we we're going to cat uh this file here ET password that's the file which uh has all the information about user accounts that exist on your Linux operating system and then we're going to grab user 30 and see if we can get it to grab is to uh ask the system to display um a section of uh of of file of the content of a file using a desired uh pattern and our pattern here is user 30 so if the The Prompt gives us nothing it means that user 30 does not exist on the system so we see here it does exist and I'm going to delete it just for the sake of uh of our project here so I'll go ahead and delete user 30 so let me let me try that and see if delete everything there and and to delete you just use the use the user uh dell command so I will not go into details of what's Happening here because uh it's not the the purpose of this video is not about talking about user management so I'll just clear the screen and and try to recall that command here and see you see you user 30 doesn't exist so we need now we need to create user 30 and we just do user you can use the user add command or add user command and and that should work so we going to do that um okay you still have to be pseudo meaning uh uh using privileges like a root user that's a super doer privileges I'll do that and then clear the screen and and now if we run the same command here to see if user 30 exist on our system and it's going to tell us that hey user 30 does exist so so now uh if you go we go back to if we go back to uh to our theme Here the the the the question here so we we know first that user 30 does exist on our system and now we need to go back to the command line and execute the steps that we need to employ to uh uh accomplish our task uh our task here so I'm going to go back to the terminal and and and what we need to do we're going to uh we're going to use this command here pseudo Chron tab uh this will allow us to uh uh get to the editing prompt or window for the Chrome tab uh utility and and and this will be specific for user 30 because we're using the option dasu to say we want to apply this to only this user and the Das e is we want to edit so we're going to press enter and then you see this uh file here and and when you see this file you just go you know everything that has has a hash or pound sign it means that it has been commanded and because it is commanded then the the script or the kernel will not the shell will not uh uh the system will not run or execute that specific line but the beauty of this file is that it comes with instructions like to defined you know like looking at this one here to define the time you can provide concrete values for minutes and it gives you how you can do that so you can just read this is like also a manual that you can use to create Crown jobs and then when you get to the end here this is where we need to add uh to add our uh uh job our specific uh commands that we want to run so we're going to do it every 27 uh minutes after the hour between 9 and 11 a.m. that's what we do then on the 10th on the 10th and 25th we will uh run this command so uh it's going to be every month uh so going to keep the Stars to say hey this is for uh uh this is to say that uh you know the first star is for the month field meaning every month and the second star is for the day of the week uh meaning every day of of uh the week and then we're going to add the command that we want to run here and the command is Echo will Echo because this could be anything it could be uh it could be backing up your a specific directory on your system backing up some packages or patching or doing anything here so uh but for for the project we're just going to say I am learning about cron jobs then you close the double quotation and then we're going to append that to this file the temp file and then uh the name the temp directory and then the name of the file would be um Crown uh Crown out so that's the name of our file so Crown out and then when you do that remember uh here we're using the Nano editor you look at the top of the screen it's a nano editor meaning that to save and then quit you you use a control X control X and then uh then you're going to do shift y you can rename the file if you want to here see here at the bottom there you can do that but will not do it I just press enter and then after we do that the next thing that we need to do is now to uh we want to verify we want to verify and and how do we verify you just you you can do the crown tab command here and then you specify the user which is user 30 then you use l-l to say we want to L list and see what we have here so this is what we have for user 30 I'm going to clear my screen so I go I go back up uh see if I can make this a little bit bigger yeah if that help okay so so I go I go back up and and then I now uh the other thing that you can also do is to go to you can LS l and then uh go to the VAR directory and spool you find the crown uh uh directory there and then here you see the activities yeah you know the the the different Crown jobs that you have created here so you have the add jobs that uh look looking at what we have on the screen I created on the 12th of February and and then you have have the ad spool and then you have the Chrome tabs okay so that's that's what we created today as of the recording of this video it's uh February 14th uh 2024 I'm going to clear my screen here and and then uh we need to delete the Chron job that we just created to do it you use this command Pudo Chron tab you and then we specify the user then we're going to say uh it then what we do we go to the file again the Chown tab file so you go back here then what we want to do is just to delete this line here the line that we added at the beginning of the video and to delete it uh on a nano editor you just use control K which is to cut and all the instructions at the bottom of the page here at the bottom of your your terminal so you're going to see that there I'm bringing this up here and so you're going to do that and then just uh crl K it's going to delete that it's going to it's going to delete all of this you know the entire line that you see there so control uh okay you see it's gone and then crl X and then shift y enter to save so that's what we have done and you can verify to verify you use again the this command here remember the crown tab command you specify the user and then the dash L which is to list when you do that you don't see anything here because every everything here has been commanded meaning that there is no action because it's been the file has been commented so that's uh pretty much what I wanted to share with you uh in terms of how you can use the uh how you can use the uh Crown how you can create Crown jobs and what we have done in this project we have scheduled the crown job as a user uh as as user 30 to Echo uh how I am learning about Crown jobs at every 27th minute past the hour between 9:00 a.m. and 11 a.m. on the 10th and 25th of every month then we redirected the output of the temp cron out file and finally we listed the entry and then deleted it so that's uh that's what we have accomplished uh today and I want Tok thank you again for watching the video God bless you and I hope to see you in the next video
Info
Channel: T2S
Views: 1,263
Rating: undefined out of 5
Keywords:
Id: cLv7SCXcqvo
Channel Id: undefined
Length: 14min 9sec (849 seconds)
Published: Wed Feb 14 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.