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

Last change on this file since 68 was 68, checked in by waue, 16 years ago

big modification

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