Creation of a cron job to restart the Ubuntu server.
I wanted to restart my Ubuntu server in the virtual machine automatically. No problem with a cronjob.
First, we connect to the server with a terminal via SSH. Then we can create the cronjob with the following command:
sudo crontab -e
The syntax of a cronjob is as follows:
minute hour day_of_month month day_of_week command
In our example, we now create the cronjob as follows
0 2 * * * * /sbin/shutdown -r now
We then save the file. We can perform a check with the following command:
sudo crontab -l