diff --git a/cron.php b/cron.php
index e5b1276899291c1a31161bb61fc6ee8c2ef23173..0595cece4f8bfd0a0571c470ebd9b4bd80a468e9 100644
--- a/cron.php
+++ b/cron.php
@@ -58,6 +58,9 @@ try {
 	}
 
 	if (OC::$CLI) {
+		// set to run indefinitely if needed
+		set_time_limit(0);
+
 		$config = OC::$server->getConfig();
 		$instanceId = $config->getSystemValue('instanceid');
 		$lockFileName = 'owncloud-server-' . $instanceId . '-cron.lock';