You can set your server to reboot every 4 hours by setting the following crontab.
First you may want to select your preferred editor otherwise vi maybe a tad too complex for someone just starting. To that first:
sudo update-alternatives --config editor
Then edit your crontab:
sudo crontab -e
There you can set your server to reboot every 4 hours with the following:
# For more information see the manual pages of crontab(5) and cron(8)
# m h dom mon dow command
0 */4 * * * root /sbin/shutdown -r now
However, you should not have a need to reboot your server every 4 hours. If you are running into that then you have a larger issue that needs to be investigated. Perhaps you have a memory leak, or something else on your server is overloaded.
You should be able to run a server for months without any service interruptions. Technically years, however you will need to reboot for a security update.