Run nutch batch script under Windows

Source: Internet
Author: User
Tags command line goto

Place the following text in the Nutch_home\bin directory, name Nutch.bat, set the following Java_home and Nutch_home, and then run%nutch_home%\bin\nutch on the command line

@echo off


set java_heap_max= "-xmx512m"


if not "%1" = = "" Goto INIT else goto echomsg


: Echomsg


echo Title: Welcome to use Beijing Line Point Technology nutch Run script


echo author:jaddy0302 mail:jaddy0302@126.com qq:5622928


Echo site:http://www.xd-tech.com.cn Line Point Technology professional vertical search engine products


Echo Nutch version:0.7.2


Echo Usage:nutch COMMAND


Echo where COMMAND is one:


Echo Crawl One-Step crawler for Intranets


Echo Admin database administration, including creation


Echo inject inject new URLs into the database


echo generate generate new segments to fetch


echo fetchlist Print the fetchlist of a segment


echo Fetch a segment ' s pages


Echo Parse parse a segment ' s pages


Echo Index run the indexer on a segment ' s fetcher output


Echo Merge Merge several segment indexes


echo dedup Remove duplicates from a set of segment indexes


echo updatedb update db from segments after fetching


echo updatesegs update segments with link data from the DB


echo mergesegs merge multiple segments into a single segment


echo readdb examine arbitrary fields of the database


echo Analyze adjust database link-analysis scoring


echo Prune prune segment Index (es) of unwanted content


echo Segread read, fix and dump segment data


echo Segslice Append, join and slice segment data


Echo Server run a search server


Echo Namenode Run the NDFs namenode


Echo Datanode Run an NDFs datanode


Echo NDFs Run an NDFs admin client


Echo Jobtracker Run the MapReduce job Tracker node


Echo Tasktracker Run a MapReduce task Tracker node


Echo or


Echo CLASSNAME run the class named CLASSNAME


echo Most commands print help when invoked w/o parameters.


Goto END;


: INIT


Set nutch_home=c:\work\nutch-0.7.2


if "%nutch_home%" = "" Set Nutch_home= ...


Set Classpath=%nutch_home%;%nutch_home%\conf;%nutch_home%\plugin


@echo @echo Off>setclasspath.bat


for%%i in (%nutch_home%\nutch-*.jar) does @echo set classpath=%%classpath%%;%%i>>setclasspath.bat;& for% I in (%nutch_home%\lib\*.jar) do @echo set classpath=%%classpath%%;%%i>>setclasspath.bat;


Goto EXEC


: EXEC


Call Setclasspath


if "%1" = = "Crawl" Set Class=org.apache.nutch.tools.crawltool


If '%1 ' = = ' admin ' Set Class=org.apache.nutch.tools.webdbadmintool


if "%1" = = "inject" Set Class=org.apache.nutch.db.webdbinjector


if "%1" = = "Generate" Set Class=org.apache.nutch.tools.fetchlisttool


if "%1" = = "Fetchlist" Set Class=org.apache.nutch.pagedb.fetchlistentry


if '%1 ' = = ' fetch ' Set Class=org.apache.nutch.fetcher.fetcher


if "%1" = = "Parse" set Class=org.apache.nutch.tools.parsesegment


if "%1" = = "Index" set class=org.apache.nutch.indexer.indexsegment


if "%1" = = "Merge" set Class=org.apache.nutch.indexer.indexmerger


if "%1" = = "Dedup" Set Class=org.apache.nutch.indexer.deleteduplicates


if "%1" = = "UpdateDB" Set Class=org.apache.nutch.tools.updatedatabasetool


if "%1" = = "Updatesegs" Set Class=org.apache.nutch.tools.updatesegmentsfromdb


If "%1" = = "Mergesegs" Set Class=org.apache.nutch.tools.segmentmergetool


if "%1" = = "Readdb" Set Class=org.apache.nutch.db.webdbreader


if "%1" = = "Prune" Set Class=org.apache.nutch.tools.pruneindextool


if "%1" = = "Segread" Set Class=org.apache.nutch.segment.segmentreader


if "%1" = = "Segslice" Set Class=org.apache.nutch.segment.segmentslicer


if "%1" = = "Analyze" Set Class=org.apache.nutch.tools.linkanalysistool


if "%1" = = "Server" set Class=org.apache.nutch.searcher.distributedsearch$server


if "%1" = = "Namenode" Set Class=org.apache.nutch.ndfs.ndfs$namenode


if "%1" = = "Datanode" Set Class=org.apache.nutch.ndfs.ndfs$datanode


if "%1" = = "NDFs" Set Class=org.apache.nutch.fs.testclient


if "%1" = = "Jobtracker" Set Class=org.apache.nutch.mapreduce.jobtracker


If "%1" = = "Tasktracker" Set Class=org.apache.nutch.mapreduce.tasktracker


call "%java_home%\bin\java"%java_heap_max%-classpath "%classpath%"%class%%2%3%4%5%6%7%8%9


: End


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.