Linux System Management
Processes
Networking
IP Configuration
Firewall
Uncomplicated Firewall (UFW) is a simple to use tool which allows you to set up firewall rules in less than 5 minutes.
By default, UFW will create a set of IPv4 and IPv6 - it is recommended that you delete whichever one you don't use.
Automation
There are tasks that we might do every time we start our system or every so often - like backing up folders, starting an application or multiple applications, or running scripts. Instead of doing it manually, Linux provides a process called Cron which we can utilise to automate these boring tasks and do them for us.
Crontabs
A crontab is a file that's utilised by the cron process to execute each line of instructions. Crontabs need 6 values in-order to work:
Value | Description |
---|---|
MIN | What minute to execute at |
HOUR | What hour to execute at |
DOM | What Day Of the Month to execute at |
MON | What Month Of the Year to execute a |
DOW | What Day Of the Week to execute at |
CMD | The actual command that'll get executed |
* | NULL |
For example, if we wanted to start a script called update_repos.sh
every Friday, we would do:
We can use a tool like Crontab Generator to make these for us since memorising the positions is a hassle and we like things easy right? The asterisks represent NULL inputs if we don't want to include additional values.
Creating & Editing a crontab
Enough with the boring stuff, let's look at how to create our own crontabs. Start by opening your terminal and executing crontab -e
You might get this on first launch, select 1 if you want to go with nano
, I prefer Vim so I'll use the second option. Scroll down to the bottom of the list and create a new line by hitting the return
key (Enter).
Now, go to Crontab Generator and create a process to automate!
Once you're done, click generate and paste the output into your crontab editor
Press Ctrl + X
to save on Nano, or :wq
on Vim. That's it!
If you want to remove your saved crontabs, you can run crontab -r
.
Last updated