This course has been updated! We now recommend you take the Full Stack for Front-End Engineers, v3 course.
Transcript from the "cron: Exercise" Lesson
>> Jem Young: So let's make a cron job. So to edit a cron job, we open crontab. Crontab is the file that has all the cron jobs. So if you sudo crontab -e, it's gonna open your cron jobs for the root users, where we wanna be. Then in your crontab file if you add oo 12 [COUGH] **, we are going to renew, we want to make sure our, yeah.
[00:00:33] Where to back up to. Yeah. We're going to make a cron job. That's what we're doing. We want our certificate to auto-renew, because I can't count on anybody to email me and let me know that my site is broken and our certificate doesn't work. So let's just set up a job we let it run, and we don't have to worry about it anymore.
[00:00:54] That's the beauty of cron jobs.
>> Jem Young: So to edit a cron job, we open crontab, which has our running cron jobs. Yes?
>> Speaker 2: I got us to select an editor. I don't know if that happened to anyone else. Does it matter, nano, vimbasic?
>> Jem Young: I'd use Vim, cuz that's one we've been using.
[00:01:13] I think the first time you edit crontab, it's gonna ask you what editor. You can use nano. A lot of people like nano now I think because it's slightly simpler to vim but, vim is a standard, that I like to use so, but use whatever you're comfortable with, yeah.
[00:01:29] All right so sudo crontab -e and easiest, even tells you it's easiest. Say vim.basic. Cool.
>> Jem Young: And as always it has helpful comments to tell you kind of what the heck you're doing.
>> Jem Young: But I'm just gonna add a new line in here for our cron job that I want.
[00:01:55] So what did I say? So, uh-oh, 12**1. Yeah. And we're gonna run certbot renew.
>> Jem Young: All right. Everybody with me, we're understanding cron jobs, things like that?
>> Jem Young: Cool, and let's just, oops. Let's exit out of here. Yeah, we're good to go. And now every Monday at, what time did I say?
[00:02:34] At noon, it's going to renew my certificate for me. If it doesn't need to be renewed, it'll just say you'll need to be renewed,don't worry about, if it does, it'll do it automatically. We don't have to worry about it. And because ran contabit sudo, we don't have to sudo cert bot.
[00:02:49] I believe, we have our own. So I have my own cron tab which runs as my user. So we wouldn't wanna do that because we'd have to sudo every single time. If we did that, it has to refer password and your jobs are gonna break. So know the difference between running something as sudo and know the difference as running as your regular user.
>> Jem Young: Right. We know cron jobs now. Just think, in the beginning you don't know what any of this meant and now you do, it's not that strange. Yes.
>> Speaker 3: We did have a questions and shaft. Is there a command to reset the UFW backwards default settings to start over with configuring the firewall.
>> Jem Young: Let's check. Let's man UFW, see if there's a reset.
>> Jem Young: Dry run, dry run, dry run.
>> Speaker 3: I saw a reset up top.
>> Jem Young: Is there a reset? Actually yeah, why don't we just search. Okay, yeah. Sudo ufw reset should reset your firewall. Great catch. That's why we use the man page.
[00:03:56] Also if you're on a man page if you type slash for most things you can just search. That's very helpful too. And to go next just lower case n, to go up- upper case n. You can't see that I'm doing it, but its upper case and lower case.
[00:04:13] Great question though. All lright, so we have got a cronjob, we have got our thing running, we don't have to worry about it anymore, it is done. See if it is going to run, it's gonna keep renewing for us, that's cool.