How to conditionally enable or disable scheduled jobs in Spring?

The most efficient way to disable @Scheduled in Spring is to set cron expression to – @Scheduled(cron = “-“) public void autoEvictAllCache() { LOGGER.info(“Refresing the Cache Start :: ” + new Date()); activeMQUtility.sendToTopicCacheEviction(“ALL”); LOGGER.info(“Refresing the Cache Complete :: ” + new Date()); } From the docs: CRON_DISABLED public static final String CRON_DISABLED A special cron … Read more

Does WGET timeout?

According to the man page of wget, there are a couple of options related to timeouts — and there is a default read timeout of 900s — so I say that, yes, it could timeout. Here are the options in question : -T seconds –timeout=seconds Set the network timeout to seconds seconds. This is equivalent … Read more

CronJob not running

WTF?! My cronjob doesn’t run?! Here’s a checklist guide to debug not running cronjobs: Is the Cron daemon running? Run ps ax | grep cron and look for cron. Debian: service cron start or service cron restart Is cron working? * * * * * /bin/echo “cron works” >> /tmp/file Syntax correct? See below. You … Read more