Hadoop initscript askes password
Posted
by
Ramesh
on Server Fault
See other posts from Server Fault
or by Ramesh
Published on 2012-06-19T11:57:25Z
Indexed on
2012/08/28
15:41 UTC
Read the original article
Hit count: 273
hadoop
I have installed hadoop on my ubuntu 12.04 single node .I am trying to execute an init script to make the hadoop run on start up but it asks password every time i execute.
#!/bin/sh
### BEGIN INIT INFO
# Provides: hadoop services
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Hadoop services
# Short-Description: Enable Hadoop services including hdfs
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HADOOP_BIN=/home/naveen/softwares/hadoop-1.0.3/bin
NAME=hadoop
DESC=hadoop
USER=naveen
ROTATE_SUFFIX=
test -x $HADOOP_BIN || exit 0
RETVAL=0
set -e
cd /
start_hadoop () {
set +e
su $USER -s /bin/sh -c $HADOOP_BIN/start-all.sh > /var/log/hadoop/startup_log
case "$?" in
0)
echo SUCCESS
RETVAL=0
;;
1)
echo TIMEOUT - check /var/log/hadoop/startup_log
RETVAL=1
;;
*)
echo FAILED - check /var/log/hadoop/startup_log
RETVAL=1
;;
esac
set -e
}
stop_hadoop () {
set +e
if [ $RETVAL = 0 ] ; then
su $USER -s /bin/sh -c $HADOOP_BIN/stop-all.sh > /var/log/hadoop/shutdown_log
RETVAL=$?
if [ $RETVAL != 0 ] ; then
echo FAILED - check /var/log/hadoop/shutdown_log
fi
else
echo No nodes running
RETVAL=0
fi
set -e
}
restart_hadoop() {
stop_hadoop
start_hadoop
}
case "$1" in
start)
echo -n "Starting $DESC: "
start_hadoop
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
stop_hadoop
echo "$NAME."
;;
force-reload|restart)
echo -n "Restarting $DESC: "
restart_hadoop
echo "$NAME."
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload}" >&2
RETVAL=1
;;
esac
exit $RETVAL
Please tell me how to run hadoop without entering password.
© Server Fault or respective owner