Hey, everyone, in this video, we're going to learn the ad command at comment is like crontab, which
allows you to schedule jobs but only once, and that's the main difference between crontab and ad.
When the command is run, it will enter into an interactive mode and you could get out of that mode
by pressing the control.
So just like when you enter crontab minus E, you get into interactive Of--i editing mode.
You specify the time and you specify the command to be schedule, whereas in at command you specify
the ad followed by the time or the schedule when you want to run.
And as soon as you hit enter, then you enter your command.
All right.
So the usage of that command is simply by running the command at follow by the hour, the minute and
if it's PM or and because at that command, it's smart enough to understand a lot of functionality that
argues order like in regular English language dictionary.
So to simply schedule a job, you can specify our minute and a.m. and p.m. and then to check the listing
or all the jobs that are in the at entry table.
You were on at queue to list at entries, then to remove any of the future entries from the list.
You go run eight at our M and the number.
Every entry in the in the table would be given or assigned a number.
You can remove that by eight at our end, followed by the number.
Then there is a demon that just like crontab.
There is a demon called Cron D. So in that we have a demon called at DX, which actually manages their
scheduling, and you could of course, manage that at a disservice through the system CTL command.
All right.
So in this video, we will create an entry by scheduling a task at, let's say, for example, for forty
five pm and we will hit enter.
And we will specify echoed.
This is my first at entry and we will output that to it at Dash Entry File.
Once I'm done, I could just simply do control D to get out of that.
Now, of course, depending on what time I'm making this video, the time can differ.
So let's go to my Linux machine.
The very first thing I have to do is check the time right now.
What time is it?
It is 17 hour three, which is like five five pm, so I will schedule the job around that time.
So let's do that.
Now we need to specify the time.
Now, if you want to put PM, then there is no need to put the military time.
You could simply do five like zero sorry, five colon and the minute.
Now it is zero three output zero five because by the time I'm done, it will be zero, five and p.m.
You could use uppercase or lowercase p.m. It doesn't really matter.
Hit Enter.
Now it comes into interactive mode.
This is where you specify Echo.
This is my first at entry.
OK.
Close and directed to at entry file and enter and simply control D to check which to check the entries
just do at queue and you will see the entry is scheduled right here.
Now what time is it right now?
It's 17 04 and I have scheduled for 17 of five.
I scheduled for a five or five p.m. right.
So what time is it going to do?
It is going to run.
Yeah, 5:00 p.m..
So right now is 17 04.
OK, so we are good.
Let's check if it is there.
It's not there yet.
Let's check the date.
OK, a few more seconds.
So let's give it a few more.
Second, and we should see that entry or that schedule running schedule multiple jobs for future.
Of course, you could schedule multiple one time job and all those jobs will be listed when you run.
At Q, all right, one more time, check the date 59, we have one second left, all right.
Now, you should be there or the file should be here, as well as minus L tr and right here is our file
beautiful and to confirm the content we do at entry.
This is the exact content.
Be specified in our at scheduling entry.
All right.
So to check the to remove any of the entries you could use simply at our end.
So for example, if I schedule a job, let's say six p.m. today, and I just want to do in that file,
I want to do Echo World.
And that's it.
And out the next one, I just do the same thing seven p.m. today and here I to echo Hello World.
Control.
Now if I do at Queue, you will see two entries for this entry has a number for the second entry, has
a number five if I buy and remove, for example, entry number five at Ah am simply five.
It is removed now.
If I do at queue, you will see it is gone.
Beautiful.
All right.
So to check the status of the demon, you do systemctl status.
At the end, you will see it is up and running again if you stop it.
You could still add the entry, but the entry that the demon is not going to run that command at that
time because your service is down.
All right, very good.
Now let's move on to the next slide, and there are other scheduling commands for futures that the format
that I'll show you.
Let's say if you want to schedule a job to run on October 16th, 2021 at 2:45 a.m., then all you have
to do is add space to forty five a.m..
You could have a space or no space doesn't matter.
And then at 10, as at October 16, is the month and 21 is this year.
If you want to schedule a job at four p.m. four days from now, you could do simply at four p.m. plus
four days is.
So easy and add reads like a regular English.
All right, so next one is at now five plus hours.
I'm sure you know that schedule a job to run five hours from now.
Yes.
Now what if you wanted to schedule something at eight a.m. on Sunday?
You could just simply do eight a.m. on coming Sunday night, and the last one is if you wanted to schedule
a job 10:00 a.m. Next month, you will do 10 a.m. Next month is just that simple.
All right.
Very good.
I hope you understand the ad command.
If you have more questions, you want to learn more options of the ad command.
You could simply run man, followed by the ad command and you will get all the different options of
the ad.
I'll see you in the next lecture.