Executing cron tasks manually in Magento

For example, we have this cron task on a config.xml file of a specific module:

<catgento_sap_sync_nonimages><schedule><cron_expr>*/15 * * * *</cron_expr></schedule><run><model>sap/cron_sync_nonimages::run</model></run></catgento_sap_sync_nonimages>


we can create a new script that loads and executes that cron task like this (create a script.php file and put something like this inside):

<?php
//Load Magento API
require_once'app/Mage.php';Mage::app();
//First we load the model
$model= Mage::getModel('sap/cron_sync_nonimage');
//Then execute the task
$model->run();

The last step would be running this script manually (php script.php).

magento 1 create admin user programmatically

<?php
    $mageFilename = 'app/Mage.php';
    if (!file_exists($mageFilename)) {
        echo $mageFilename." was not found";
        exit;
    }
    require_once $mageFilename;
    Mage::app();

    try {
        //create new user by providing details below
        $user = Mage::getModel('admin/user')
            ->setData(array(
                'username'  => 'admin1',
                'firstname' => 'John',
                'lastname'  => 'Doe',
                'email'     => 'john@example.com',
                'password'  => 'welcome123',
                'is_active' => 1
            ))->save();

    } catch (Exception $e) {
        echo $e->getMessage();
        exit;
    }

    try {
        //create new role
        $role = Mage::getModel("admin/roles")
                ->setName('Student')
                ->setRoleType('G')
                ->save();

        //give "all" privileges to role
        Mage::getModel("admin/rules")
                ->setRoleId($role->getId())
                ->setResources(array("all"))
                ->saveRel();

    } catch (Mage_Core_Exception $e) {
        echo $e->getMessage();
        exit;
    } catch (Exception $e) {
        echo 'Error while saving role.';
        exit;
    }

    try {
        //assign user to role
        $user->setRoleIds(array($role->getId()))
            ->setRoleUserId($user->getUserId())
            ->saveRelations();

    } catch (Exception $e) {
        echo $e->getMessage();
        exit;
    }

    echo 'Admin User sucessfully created!';
    @unlink(__FILE__);
    ?>