What are Crontabs & Watchdogs?

What are Crontabs & Watchdogs?

Crontab and watchdog?

So, for a service, we had the idea of putting a cron tab to execute a script, essentially like a watchdog.

Crontab is a command-line utility in Unix-like operating systems that is used to schedule commands to be executed periodically at fixed times, dates, or intervals.

It allows users to automate repetitive tasks by defining the schedule for when specific commands or scripts should run.

Every day, for example, it would be triggered, and the logs would be written into another file (we chose the location of the file).

Why?

It was the simplest solution for our program and quite fast*.*

Command: crontab -e (using iTerm as a shell)

It will get you to a vim editor file to input your lines of code.

crontab -e

Here, we execute @hourly and then execute the do.sh file in the Docker user; forwarding the logs to the do.log file.

The 2>&1 redirects Channel 2 (standard Error) to the same place, which, in this context, is Channel 1 (standard Output).

The first time I heard about this, I understood nothing; it was like I was listening to Chinese 🙈.

But now, it’s more and more understandable; especially after seeing it being executed.

It’s a service that is quite helpful on a Linux machine