Placeholder Image

字幕表 動画を再生する

  • please go to the line the computer guy dot com in order to view schematics, code and Maur for the projects that you are learning about, welcome back.

  • So in today's video, I'm going to show you how to use a tool called KRON Tab to be able to schedule events within your Lennox environment.

  • So when I talk about scheduling the events, basically what this means is you're going to be able to put in a full fledged command something, let's say, possibly deleting cached files on your server, possibly optimizing a database, maybe even running analytics from the command lines.

  • What you're going to be able to dio is you're going to be of a schedule win.

  • An event like that may occur.

  • What you do is basically you put the time or how often you want the event to occur.

  • You put the full command in, and then basically you say the file and then that will run.

  • So if you say every minute or every hour or every Wednesday, that type of thing, basically, that command will run on that schedule.

  • And so this could be very important in the Lenox world again.

  • When you're using a server.

  • A lot of times you do things such as you cache files or possibly you need a data bass bass optimized or even again.

  • You need an anti virus software to run every once in a while.

  • And so using the chron time will allow that to happen.

  • This can also be very important if you're using off the shelf packages on your Lennox server.

  • So let's say you're using some kind of, let's say, content management system something like that.

  • They may require that you use the CHRON tab in order to schedule certain events to happen so that the content management system will be able to work effectively.

  • Now when you start dealing with Crime Tab, the thing that I want to tell you the thing that I want to tell you his crime tab is incredibly simple.

  • Unfortunately, he was designed by Lennox people.

  • So what should be an incredibly simple thing, which is incredibly simple, turns out to be a bit of a mess when you actually go and then you try to actually use it in the real world.

  • So one of the things that I do want to warn you whenever you're using the Chron tab is that when you create your KRON tab tasks that they will be created for each user that you have on your Lennox system.

  • So if you have multiple users on your Lennox system, you can actually have multiple users with multiple different KRON tap files.

  • So whenever I look at my system, so right now I have the user named Bob.

  • I have a user named Tim and then also you have suit.

  • Basically, you have the route user.

  • So whenever you go and you create these KRON tap tasks, they will be under each individual user account.

  • So this is one thing that you may be thinking about in the administrative world is possibly only using one user account for the chron tabs that you create.

  • The other thing to remember is that when you're dealing with Kron Tab events is that they will they will operate under the privileges of the user that you have created them for S O.

  • If you use pseudo Kron tab on, then you put in the command than that.

  • Then the event that you have happened will have root level permissions.

  • If I use Bob or if I use TEM for the examples that I will show you.

  • Then there will only have either Bob or Tim's permission.

  • So this is an important thing to be thinking about, Especially when you go in there.

  • Let's try and clean out a database.

  • You're trying to have events happen on your system.

  • If you simply do the Chron tab for your user account, you may not have the elevated permissions that are required in order to do what you want.

  • Done.

  • So what I'm going to show you today is how to edit a Krahn tap file.

  • So if you want to have the chrono jobs, run as you eunuch Ron Tab, space hyphen E for it.

  • And so then whatever you edit, whenever you add that will be based off of your account.

  • If you want the route user to be able to have permission to basically do the task, you're basically one of those task to be run under the root level.

  • Permission.

  • You would actually do sue do crime that Kron Tab space hyphen E.

  • And then that will put you into the root level.

  • And then whatever you add it in the chron tab basically that will allow that to happen as the route user account.

  • So those air couple of things that you need to be thinking about whenever you use contact again, Kron Tab itself is simple.

  • But then you get into this mess of how it was designed by the Lenox folks s O that let's go over the computer so I can do a demonstration and basically show you how Kron Tam works in the real world.

  • So here we are, my abundance server.

  • Again, I'm using 18.4 point three.

  • Lt s So what I'm showing you today should work fine on you Bun too.

  • I do have to say when you're using Kron tohave there may be differences with the different distributions.

  • So if you're having some problems you're using Scent OS or something else, you might just have to do a little bit of a Google search just to verify what's going on.

  • As always.

  • Welcome the Lenox World s.

  • We're gonna log in, Bob got 123456 We're going to hit in.

  • There were long dead.

  • We're gonna hit clear eso from here.

  • The first thing that I want to show you is just how bad?

  • How horrible.

  • Lennox coders are people who that developed these products for Lennox.

  • I want to show you how nasty they could be.

  • So the command that you're going to use to actually edit the contact file is Kron Tab, Space hyphen E.

  • But what if you're tired or if you forget and you just put in Kron to have all you do is put in contact, right?

  • How bad can that be for you?

  • Well, if you hit enter What you notice is you're going to get into this.

  • What is this?

  • This is this.

  • I really okay.

  • No big deal.

  • I think you know, shift.

  • You know, I escape.

  • No.

  • And you're kind of just stuck in whatever the hell this is.

  • So this is one of those little booby traps the people that coded Lennox will lead for than a dumb people.

  • Basically, this is this is what tries to get people to give up on Lennox and go home because you do a stupid little problem, and then you're like, I don't know how to get out of this.

  • So in order to get out of this, what you do is you press down control you press down X, then you press down, see?

  • And then, as you can see and that gets you back to the command Prompt.

  • So control X c If you accidentally just do contact and they can't can't, uh, can't say enough.

  • Oh, those Lennox people are just evil.

  • They're just evil in a way.

  • So anyways, now let's go and actually take a look at a real Kron tabbed file.

  • So again, all the crown tabbed files their individual contact files for each user.

  • So I'm long in his bob.

  • So I'm going to be looking at Bob's contact file on one new hyphen e.

  • And it's a Krahn tab.

  • Space hyphen E for at it, I hit Enter and the first thing is going to do is going to ask me what editor I want to use eso.

  • Whenever you set this, you actually have to reset.

  • So basically this is going to become the default.

  • From now on, there's a command that allows you to reset it.

  • So you should think about this.

  • You can use nano.

  • If you just press enter, it'll go nano.

  • You can use the basic them tiny or e d.

  • I have shown you folks how to use them, so I would argue you should use them again.

  • That's what you know.

  • Use what you know.

  • So I will press too.

  • But you can use one of these different editors that I'm going to head enter.

  • And now I am editing the chron file, get all the basic information up here, and then the command is down here.

  • So what you're gonna do is you're actually just got to type out a whole list of these commands with whatever time you want them to run.

  • So the first part of the Chron let me take Let's take a look at and this is the part over here that's in yellow.

  • So all of this and yellow, this is essentially what command you would type into the command line for what you want tohave occur.

  • So what I have here is I'm using this.

  • A commander called Touch so touches a weird little command.

  • What it does is it can either create a file or it when it touches a file.

  • Basically, all it does is it modifies when that file was edited.

  • So it's just a simple way to make sure you can connect to a file or touch a file or make sure and events happening.

  • It's all I'm doing here.

  • I'm saying Touch this final called Crime Test in the Bob folder in the home directory.

  • So it's got to d'oh is basically it's gonna go in there and it's simply going to modify the last time the file was modified.

  • So every what I have set up here, basically, every minute, what's going to happen?

  • Is it simply going to touch that particular file?

  • And it's going to change the modified time, Just basically a simple little thing.

  • So what you're gonna do is you're gonna type in the full command here.

  • So if it's if you're gonna run antivirus software so you would type in, you know, the command for the antivirus offer, all the options, all the arguments.

  • If you're going to clean out a directory, you would type that in here.

  • So basically what this yellow is is whatever command that you would type into the command line.

  • That's what you put here.

  • Then, in front of that, what you have is this is the actual timing.

  • So when the wellness event take place.

  • So these are all stars.

  • So since they're all stars but this means is every single minute it's going to touch this Krahn test file s o the first star here.

  • So basically stars a wild card.

  • It means every s o.

  • The first star here represents the minute so minute.

  • So you put in You can put anywhere between 0020 59.

  • So what minute do you want things to happen?

  • So you if you want everything to happen on like the 10th minute you would put 10 here if you want everything, I guess 09 there.

  • If you want everything to happen on the 19 or the 20th minute, you will put 19 there.

  • So this is you.

  • Put what minute You want something happen?

  • Then you put the hour.

  • So what?

  • Our 24 hours in a day.

  • So zero through 23 you will put what hour here.

  • So if you want something to happen at, let's say one o'clock in the morning or something like that you have put that number here, then passed that you have the day of the month.

  • So how many days are particular month you have the day there, then you would have the month year So whatever month it is, and then the final one is day of the week.

  • So if you want something to run, let's say every Sunday you could put a number here.

  • So these five numbers, these five numbers remember, represent the timing for when events should occur.

  • S oh, there's a nice little Web site called Kron tab dot grew rooms, and this site makes it very easy to be able to figure out what the timing should look like.

  • Eso currently here they given examples of 54 star star star on it says, basically at 405 every morning.

  • So this is the hour, so four and then five is the minute.

  • So basically at 405 and then it's every day of every month and every day of the week.

  • So every day, at four or five in the morning, this event will be triggered.

  • Click on random.

  • Here s so this gives you, you know, different things to show you.

  • So basically, what this says is at the fifth minute, so basically right after midnight.

  • So at 12 05 in the morning, so zero would be midnight.

  • So 12 05 in the morning, basically every day in August.

  • So this is a month in August, this event will occur.

  • Click random again and so we can see at two o'clock are 2 15 in the afternoon.

  • On the first day of every month, this event will occur.

  • And so it's a cool part about this is you can go in and you can tweet with the different numbers.

  • You can play around and you can figure out what that time coach should look like.

  • And this also gives you some information below telling you different things.

  • So star equals any value you can value list separators.

  • So you could have something happened at the 10th minute.

  • The 20th minute, 30th minute a range oh, values new step values that also shows you allowed values.

  • And one of things here with the allowed values is due notice it 0 to 59.

  • So for this, counting zero equals one and 59 basically equal 60.

  • So, basically, just remember that when you're dealing with it again, if you look at the hour, gives you the same types of things.

  • If you look in today again, allow values is one through 31 for there months, you know, one through 12 or can be worth your December on day of the week, You know, some through sad or the different days for the days of the week.

  • So you can go through here and you can play with it to see how well it works on.

  • And then we'll all you can do is then you go back.

  • And basically, whatever time code you figured out, you plug that in here.

  • And then after that, you put a space, and then you put the command line command that you want to use, and then you go away, Ugo.

  • Now, if you're not sure of what you're doing, your students still a little bit new with this, I would I would recommend you use a command such as touch so literally.

  • All touchy does is simply touches this particular file just to change the modification time stamp.

  • Because if you screw up the timing or whatever, and you're doing a like a real command, so again cleaned it out a database, something like that, and you do something stupid, you might actually cause a real problem for the server.

  • So that's basically how this works now again.

  • So if I'm sitting here and I'm I'm editing this.

  • So So I go into insert, I come down here.

  • Oh, I don't know.

  • Let me just edit this.

  • So I just put that to one.

  • So Kron, test one.

  • Then I'll do escape, and then I'll do Colon.

  • I'll do w for right save queue for quick.

  • And then I get out of this second and clear the screen.

  • Do l s base hyphen owl and we can see you know, I have KRON test here.

  • And the last time it was touched, it was at 3 25 And so in a little bit, we should get the chron test one now to be clear.

  • Eso that crime tap file that I showed you is only four Bob again.

  • Eso not so.

  • Basically all users can have their own contact file.

  • But again, when the crimes have events occur, they will be used.

  • They will have the permission of whatever user account you're using.

  • So if you want to have things with, let's say a root level permission, you would use Sue Dio and then you do Krahn cap space, Hyphen e.

  • And then if we open this up 23456 we can see that this particular file is empty.

  • So the pseudo crown tap file is empty.

  • And so you could come in here and you could put in events that you want to occur under that root level permission.

  • Now, get out of this, Colin Que, Because I'm using them now I know clear now I should be able to do l s life in hell and they're ago.

  • So basically, we have that touch command.

  • So after a minute, it ran.

  • And so I now said it to do crime test one.

  • So it touched a quote unquote contest.

  • One file on it created at 15.

  • 26.

  • So that's again.

  • Basically, when we're talking about Kron Tab, that's what we're dealing with with with this particular tool.

  • Now, there's a couple of other things that you could do with this.

  • So if you want to see like the Chron tabbed files for either your user account or another user account, you do Krahn cab space hyphen.

  • L So this will show you the chron tabbed file for your account that your walked in as and we can come down here and we can see so I can't have not edit it.

  • I'm not modifying it.

  • Don't worry about that.

  • So I could see.

  • OK, this is the time doing touch.

  • Baba home.

  • Chron Chron Test one so I can see that.

  • So that's useful on.

  • Then.

  • You can also look at the Chron tabbed files for other users.

  • So just clear again.

  • So I have the other user named Tim that I've used before.

  • So let me just make sure I have the rights to actually look at the user contact file.

  • So you do studio, Don't do Kron tab and a space than hyphen you for user space.

  • So we have this 10 user account space.

  • L So this will show us the chron tabbed files for the Tim user account I hit.

  • Enter on, then I can see here.

  • So I have a talk it every minute of the day going to the home Tim Directory Crime test, Tim.

  • So basically, every minute this Krahn test tim file is being touched on dso That's a way that you can go through again.

  • You can try to see what other KRON tap files there are and what other chronic events may be occurring.

  • This could be one of the reasons why trying to deal with with KRON events can become a little bit complicated.

  • The Lenox world.

  • If you have multiple user accounts and you create multiple crown tabbed files amongst all of those user accounts, it could become very difficult to keep track of everything.

  • So again, again, just one of those things to be thinking about now, as I talked about before.

  • Once you set your kron tap editor, it will remain.

  • Whatever it is, you said it too.

  • So I knew Kron Tab space hyphen E to edit.

  • You notice we now drop into them.

  • So we set it to them.

  • And now it's been.

  • But the question has to be a CZ.

  • Well, what if I don't want to use them?

  • Or what if I want to use them, but I accidentally selected Nano instead, eh?

  • So, in order to to reset the editor, all you have to do is use a basic command to be able to reset the default editor.

  • So you're gonna do R m space?

  • Then we're gonna do is you're gonna do that little squiggly Mark.

  • Then you're going to forward slash dot and then selected Underscore editor.

  • So basically, this command right here will remove the selected editor that you're using for for Kron Tab, you hit inner.

  • Doesn't really tell you anything.

  • But now I would be proud.

  • Tab, Space E.

  • What you'll notice is you now are able to select your editor again.

  • So again, if you come in here, you're not thinking about it and you get the anarchy.

  • Do you have the enter key?

  • Now you're using Nano.

  • You're like, Wait, but But Eli taught me how to use vim.

  • I don't know how to use this thing by using that that remove command that allows you to re set the default editor.

  • And so that's the basics of Kron Tab.

  • And it's really one of those things you just gotta play around with a little bit.

  • The only really difficult thing is just making sure you get the timing correct.

  • You know how often you want an event to occur and then also making sure whatever user account you're using to do the chron tab events that it actually has permission to do whatever the hell it is you're trying to get done with that.

  • That's really all there is to it.

  • So there you go.

  • That's how to use Kron Tap again in the Lenox world.

  • This is one of those things that's relatively easy to use.

  • So long as you experimented.

  • You play a little bit, so you get an idea of what is happening.

  • And as long as you understand that the people that code for Lennox are evil, they are evil, evil people.

  • And they really do some things that are just where you sit there go.

  • Really, Really.

  • You can't just fail out.

  • You can't just have this.

  • You know, I typed in something wrong.

  • Just can't fail that out in a reasonable fashion.

  • You have to leave me at whatever it is you get when you're typing Kron Tab and nothing else.

  • And so this is one of those perfect examples of where I want to show you of where Lennox itself is not generally that difficult.

  • What it is is how things have been developed, how things have been coated there.

  • So it is such one of those things where you have to be precise.

  • And if you don't do everything absolutely correctly, then you can get lost really quickly and everything can turn into a mess.

  • And that's why frankly, a lot of people give up.

  • Now again, when you're doing the Chron tab something, Think about the Crown Tap is again.

  • There are different user accounts for for the Chron tabbed files.

  • So again you can have a TEM user account.

  • 10.

  • Tim Kron Tap account in a Bob Crown tab accounting pseudo KRON Tap account.

  • So somebody be thinking about is when you're building out your server.

  • Really think about how many users you want to be able to set things like KRON tap events to happen?

  • Do you really want that many people to be able to cry jobs?

  • Or do you want that for only a couple of users based off of permissions?

  • That's one of those things to think about again with a lot of this stuff.

  • In the Lenox world, there are far more commands out there.

  • There are some interesting things that you could do with crime jobs on be ableto look at different types of things, but I didn't show you them today because I don't want to overload you with too much information.

  • I'm gonna keep this pretty simple for you.

  • And so the main thing is just figuring out how to deal with timing, how to make sure the command actually does what you think the command is going to dio and then figure out the different user accounts that will have different KRON tabbed files again.

  • It is very important in the real world if you're gonna be doing this in a production environment to get T make sure whatever command you plug in is specific command you need to plug in if you type of file name wrong.

  • If you don't put a space in there right, every there's a time and then it's gonna run that command.

  • So if you screw up that command, that can cause you a lot of major issues.

  • If you remove a directory or you remove files from the wrong directory, you know that might end up crashing or server.

  • So just check and recheck a few times.

  • Make sure the command that you're plugging in is what you want tohave occur.

  • And so when that that's really all there is to it Across jobs in the Chron tabbed file.

  • As always, I enjoy doing this video and look forward to the next one.

please go to the line the computer guy dot com in order to view schematics, code and Maur for the projects that you are learning about, welcome back.

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

A2 初級

Linux - スケジュールされたタスクのためのCronジョブ (crontab) (Linux - Cron Jobs for Scheduled Tasks (crontab))

  • 1 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語