Chinaunix首页 | 论坛 | 博客
  • 博客访问: 482235
  • 博文数量: 108
  • 博客积分: 25
  • 博客等级: 民兵
  • 技术积分: 1134
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-29 19:43
文章分类

全部博文(108)

文章存档

2016年(10)

2015年(9)

2014年(73)

2013年(16)

我的朋友

分类: 系统运维

2014-04-22 17:10:31

1.切换到hadoop用户执行启动脚本:/usr/bin/sudo -u hadoop  -i  hadoop-daemon.sh stop  namenode
2./etc/monitrc里追加
check process hadoop with pidfile "/usr/local/hadoop/pids/hadoop-hadoop-namenode.pid"  ##注意红色字
        start program = "/usr/bin/sudo -u hadoop  -i  hadoop-daemon.sh start  namenode"  ##下面这2行是启动和停止脚本。
        stop program = "/usr/bin/sudo -u hadoop  -i  hadoop-daemon.sh stop  namenode"

主要涉及到sudo的用法切换到特定用户执行命令。

-s [command]
                   The -s (shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in
                   passwd(5).  If a command is specified, it is passed to the shell for execution.  Otherwise, an interactive shell is executed.
大意是指定shell 环境。但不会引用用户的环境变量。
 -i [command]
                   The -i (simulate initial login) option runs the shell specified in the passwd(5) entry of the target user as a login shell.  This
                   means that login-specific resource files such as .profile or .login will be read by the shell.  If a command is specified, it is
                   passed to the shell for execution.  Otherwise, an interactive shell is executed.  sudo attempts to change to that user鈥檚 home
                   directory before running the shell.  It also initializes the environment, leaving DISPLAY and TERM unchanged, setting HOME, MAIL,
                   SHELL, USER, LOGNAME, and PATH, as well as the contents of /etc/environment on Linux and AIX systems.  All other environment
                   variables are removed.

这个参数会引用用户的.bashrc.

阅读(585) | 评论(0) | 转发(0) |
0

上一篇:linux memory

下一篇:ubuntu 安装puppet master

给主人留下些什么吧!~~