Bootstrapping Craft gives fatal error
That bootstrap file is only meant to be used by web applications. Even if you got past this error, the file is still going to give you a WebApp instance, when what you really want to be working with in that environment is a ConsoleApp.

If you want to load Craft from the command line, use craft/app/etc/console/yiic instead (make sure it has executable permissions), or if you already have a PHP script running, load yiic.php.

Unfortunately those files don’t work like bootstrap.php though - they will not only instantiate a ConsoleApp instance, they’ll run it as well. So you would need to provide your own functionality through a plugin that adds custom console commands. You would do that by creating a consolecommands folder in your plugin folder, with files inside it that end with Command.php (e.g. MyPlugin_UtilsCommand.php) and a matching class name, which extends BaseCommand.

More details about how to write the class are available from BaseCommand’s class reference.