Cron a cli router na webhostingu

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
xtrat
Člen | 4
+
0
-

Jsem v tomhle trochu nový a mám problém, že Cron na webhostingu nespouští metodu, kterou má spouštět každou hodinu…

Tuhle konkrétní metodu:

Metoda funguje, když jsem jí zkusil dát třeba do HomepagePresenteru do startup, šel na homepage, tak se mi mail poslal a vše se vykonalo jak mělo, jakmile to mám nastavené na spouštění Cronem jednou za hodinu, tak se metoda vůbec nezavolá… ani se nic nenapíše do logů, tak nevím čeho se chytnout

public function sendBetaInviteMail() {
	$subject = 'Votestic invitation';
	$body = "Hello,\n\n
	we are so excited that we can introduce you this amazing web platform named Votestic. Votestic is a unique place where you can clearly state your opinion
	and where you quickly get feedback for your deciding. When you ask for opinion on classical social networks, people just give you likes for as many things
	as they want. But if you give them options, they must choose one. This says a lot more about their opinion and you'll see soon what is the right choice.
	For example: do you know whether it is better to get a dog or cat? Is it better to go to nude beach or wear a swimsuit? To play football or hockey?
	And finally, who are more beatiful: brunettes, or blondes? Anything you want to know you can find out on Votestic.com!
	But now we don't want to hold you off, because you are invited into a group of people with unique access to Votestic! Try it and enjoy it now!\n\n";
	$users = $this->getTable('invited')->where('NOW() > end_time AND in_system=?', false);
	foreach ($users as $user) {
	    $password = $this->generatePassword();
	    $name = $this->random_string(8);
	    $email = $user['email'];
	    $body .= 'Your password: '.$password;
	    $this->getTable('invited')->where('email=?', $email)->update(array('in_system' => true));
	    $this->getTable('user')->insert(array('name' => $name, 'email' => $email, 'password' => ($password . ReviewModel::$user_salt)));
	    $this->sendMessage($email, $this->from, $subject, $body);
	}
    }

Router:

public static function createRouter()
	{
		$router = new RouteList();
                $router[] = new Route('[<locale=en cs|en>/]<presenter>/<action>[/<id>]', "Homepage:default");
		$router[] = new CliRouter(array(
		    'action' => 'Cron:sendNotification'
		));
		$router[] = new CliRouter(array(
		    'action' => 'Cron:AddPointsSetWinners'
		));
		$router[] = new CliRouter(array(
		    'action' => 'Cron:SendBetaInvitation'
		));
		return $router;
	}
Lukeluha
Člen | 130
+
0
-

Co přesně ten Cron spouští za příkaz?

xtrat
Člen | 4
+
0
-

Už jsem na to přišel, chyba je v tomhle:

if (!$this->getContext()->parameters['consoleMode']) {
            throw new \Nette\Security\AuthenticationException;
        }

Něco na tom je špatně, protože do logu se mi zapsala ta výjimka, kterou tu vyhazuju… ale nerozumím tomu proč to nesplňuje tu podmínku, jakmile jsem odstranil ten if, tak se vykonalo co mělo

Editoval xtrat (12. 7. 2015 12:16)