/dev/null 2>&1'; /** * Run the migrations. * * @return void */ public function up() { $output = shell_exec('crontab -l'); if (strpos($output, 'ami:flush-events') !== false) { return; } file_put_contents('/tmp/crontab.txt', $output . self::CRON_ENTRY . PHP_EOL); exec('crontab /tmp/crontab.txt'); } /** * Reverse the migrations. * * @return void */ public function down() { $output = shell_exec('crontab -l'); $lines = explode(PHP_EOL, trim($output)); $lines = array_filter($lines, function ($line) { return strpos($line, 'ami:flush-events') === false; }); file_put_contents('/tmp/crontab.txt', implode(PHP_EOL, $lines) . PHP_EOL); exec('crontab /tmp/crontab.txt'); } }