Monday, March 18, 2013

Tiny Tiny RSS Reader - Unable to update through command line

I tried multiple things but I was unable to run update.php from command line.

Here is the solution.

I just copied the code required for feed updation and ran that script from command line. Here is the code :
Here is the cronjob command(if you are on hostmonster) :
wget complete_path_to update_feeds.php



update_feeds.php
#!/usr/bin/php53s
<?php
set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
                get_include_path());

define('DISABLE_SESSIONS', true);

chdir(dirname(__FILE__));

require_once "functions.php";
require_once "rssfuncs.php";
require_once "config.php";
require_once "sanity_check.php";
require_once "db.php";
require_once "db-prefs.php";

if (!defined('PHP_EXECUTABLE'))
define('PHP_EXECUTABLE', '/usr/bin/php53s');

// Create a database connection.
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);

init_connection($link);
// Update all feeds needing a update.
update_daemon_common($link);

// Update feedbrowser
$count = update_feedbrowser_cache($link);
_debug("Feedbrowser updated, $count feeds processed.");

// Purge orphans and cleanup tags
purge_orphans($link, true);

$rc = cleanup_tags($link, 14, 50000);
_debug("Cleaned $rc cached tags.");

db_close($link);

if (file_exists(LOCK_DIRECTORY . "/$lock_filename"))
unlink(LOCK_DIRECTORY . "/$lock_filename");
?>

No comments:

Blog Archive