How can I set the CentOS to restart a service on a time interval?
As said before you need a cronjob to make a time-specific event.
It's a bit confusing at the beginning, but here're examples:
Setting time interval
min hour day month day of the week /var/www/app/test.sh
Note - a day of the week are defined in USA week start in Sunday /var/www/app/test.sh - Path to the script or command you'll execute in a time manner.
Here's an example of running by backup script every day at 00:05 only on Saturday AND Sunday:
5 0 * * 0-1 /root/scripts/backup/dayly-backup.sh
With the same command you can restart some service (let's say Apache) everyday at midnight (on Ubuntu):
5 0 * * * /etc/init.d/apache2 restart
Remove crontab (will remove all crontabs defined)
What service you need to restart? Keep in mind that most of the services have special modes for restarting them (without killing the service, otherwise this will cause a data loss).