All right, next task is about job scheduling.
So schedule assistant, the timer job that writes, hello folks, to Syslog every Monday
through Friday at 2 a.m. and make sure this job is executed as the user Chisha.
Let's check it out.
Now you might think this is an easy one.
Well, there's quite a few things to consider.
We need login CTL, enable linger for user Chisha, because it's not specifically mentioned,
but we want the job to be executed as a user.
And it doesn't sound fair if the user needs to log in for the job to work.
So we need to enable lingering.
Next, we need SSH to log in as said user to localhost.
And that is because this works from a login shell and not from a sub-shell.
And then we need to create the path for local systemd units.
So dot config slash systemd slash user.
Now we go into this directory, dot config systemd user.
And there I'm going to use vi-hello.service.
We need the specification of the unit.
So the unit has the description is write hello folks to syslog.
And then we have the service.
And the service, well, I would say type is one shot because it's a command that should
be finishing.
And the command that we are running is xxstart is user bin logger, hello folks.
Now the service needs to be triggered by a timer unit.
So in the same directory, we need to create this timer unit.
So once again, vi-hello.timer, it's important that they both have the same first name.
And then there we are going to use unit section with a description is run hello service Monday
through Friday at 2 a.m.
And then we have timer specification and in the timer, we put this on calendar is mon
dot dot Friday star star star.
That's with hyphens for all the different dates.
And then 02 colon 00 colon 00.
Have a look at the main page systemd.time for notations like this.
And for examples of what you can do, then we are absolutely going to use persistent
is true.
This is taking care that the job will be executed if the system happened to be down at 2 a.m.
And then unit is hello.service.
That's also optional.
If you don't specify the unit, it will pick it out automatically.
And then we do an install is an install section where we have wanted by is default.target.
Do remember for for a user unit, you cannot use multi-user target.
And this is why we have this default target right here.
All right.
So that is bringing us pretty close to the solution.
Now we need to enable it.
So systemctl minus minus user daemon reload as user cheese because he's the one that should
be running it.
So systemctl minus minus user enable.
And we need a space here.
So enable minus minus now hello dot timer.
And then we can we can check systemctl minus minus user list timers hello dot timer.
And there we can see that it is scheduled to be running at some point in the future.
Now this is all.
There's only one inconvenience.
And the inconvenience is that right now it's almost 11 a.m.
So we need to wait for a long time.
And if you want this to work, maybe you want to temporarily change your timer and run it
two minutes from now, verify that it works and then put it back to the time that you
were asked to run the timer.
And that should be doing it.