source: nutchez-0.1/debian/nutchez.postinst @ 66

Last change on this file since 66 was 66, checked in by waue, 15 years ago

NutchEz - an easy way to nutch

  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#!/bin/sh
2
3echo "$1"
4
5if [ "$1" != configure ]
6then
7  exit 0
8fi
9
10setup_hdfsadm_user() {
11  if ! getent passwd hdfsadm >/dev/null; then
12    useradd hdfsadm
13    mkdir -p /home/hdfsadm/.ssh
14    mkdir -p /var/log/nutch
15    ssh-keygen -t rsa -q -f /home/hdfsadm/.ssh/id_rsa -N ""
16    cp /home/hdfsadm/.ssh/id_rsa.pub /home/hdfsadm/.ssh/authorized_keys
17    chown hdfsadm:hdfsadm /var/log/nutch
18    chown -R hdfsadm:hdfsadm /opt/nutch
19    chown -R hdfsadm:hdfsadm /home/hdfsadm
20  fi
21}
22
23check_root() {
24  if ! test -e /root/.ssh/id_rsa ; then
25    ssh-keygen -t rsa -q -f /root/.ssh/id_rsa -N ""
26  fi
27  if test -e /root/.ssh/id_rsa.pub ; then
28    if ! test -e /root/.ssh/authorized_keys ; then
29      cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
30    fi
31  else
32    ssh-keygen -t rsa -q -f /root/.ssh/id_rsa -N ""
33    cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
34  fi
35
36}
37
38start_hadoop() {
39  if getent passwd hdfsadm >/dev/null; then
40    su -c "/opt/nutch/bin/hadoop namenode -format" hdfsadm -
41    su -c "/opt/nutch/bin/start-all.sh" hdfsadm -
42  else
43    /opt/nutch/conf/hadoop-env.sh
44    /opt/nutch/bin/hadoop namenode -format
45    /opt/nutch/bin/start-all.sh
46  fi
47}
48show_message() {
49  echo "You can quickly start by following ways [in /opt/nutch/ with root privilege]:"
50  echo "(1) Modify the urls/urls.txt file with indicate urls, one site one line."
51  echo "(2) Use this instruction \"bin/nutch crawl urls -dir search -depth 4 -topN 50\" to crawl web"
52  echo "(3) Type \" tomcat/bin/startup.sh \" and use browser to check the result in http://localhost:8080/"
53  echo "Enjoy !"
54}
55#setup_hdfsadm_user
56#check_root
57#start_hadoop
58show_message
Note: See TracBrowser for help on using the repository browser.