Use crontab which OSX is also using.
sudo crontab -e
0 4 * * * /sbin/shutdown -r +5
m h dom mon dow command
minute hour dayOfMonth Month dayOfWeek commandToRun
this would reboot your system every day at 4:05am. (4:00am + 5 minutes)