The cron
package is the normal tool for scheduling events on your system. You can put actions into your user's crontab with the crontab -e
command. Although as you need to use sudo to execute the init.d script, this won't work unless you've set up sudo usage with no password for that command.
My suggestion is that you edit the root crontab, by doing sudo crontab -e
, and enter the line:
30 6 */2 * * /usr/bin/service tomcat7 restart
This will restart tomcat7 at 6:30am every 2 days. If you want a different time, just alter the first two numbers. The command probably looks different to what you'd expect, but in 14.04 the correct way to use scripts in /etc/init.d
is to use the service
command. More information on cron usage can be found here.