谁帮我写个shell脚本 万分感谢!!!

sh/bash/dash/ksh/zsh等Shell脚本
回复
nameaj
帖子: 39
注册时间: 2009-01-01 14:06

谁帮我写个shell脚本 万分感谢!!!

#1

帖子 nameaj » 2012-09-16 15:47

主要功能是:在非root用户运行本shell脚本(php system函数调用该脚本来重启apache2程序) 用expect模拟输入su密码 来重新启动apache2程序
头像
lilydjwg
论坛版主
帖子: 4258
注册时间: 2009-04-11 23:46
系统: Arch Linux
联系:

Re: 谁帮我写个shell脚本 万分感谢!!!

#2

帖子 lilydjwg » 2012-09-16 16:20

去百度知道问吧,那里适合伸手党。
aerofox
帖子: 1453
注册时间: 2008-05-24 8:30

Re: 谁帮我写个shell脚本 万分感谢!!!

#3

帖子 aerofox » 2012-09-16 23:03

没必要 expect + su 吧,直接用 sudo,配置成启动 apache2 不需要密码就是了。
nameaj
帖子: 39
注册时间: 2009-01-01 14:06

Re: 谁帮我写个shell脚本 万分感谢!!!

#4

帖子 nameaj » 2012-09-17 9:06

aerofox 写了:没必要 expect + su 吧,直接用 sudo,配置成启动 apache2 不需要密码就是了。
这不安全
nameaj
帖子: 39
注册时间: 2009-01-01 14:06

Re: 谁帮我写个shell脚本 万分感谢!!!

#5

帖子 nameaj » 2012-09-17 9:08

我现在改用C编程 不过只能关闭apache2 不能重启 打算在写个程序监控apache2程序 如果程序被关闭 就自动启动apache2
meditation
帖子: 217
注册时间: 2009-10-06 21:41
系统: ARCH

Re: 谁帮我写个shell脚本 万分感谢!!!

#6

帖子 meditation » 2012-09-21 22:47

何必呢?整的这么麻烦,又是C,又是shell...
买个cpanel不就得了。或者直接找个带panel的主机
Dohw0Doh
帖子: 80
注册时间: 2012-08-23 19:37

Re: 谁帮我写个shell脚本 万分感谢!!!

#7

帖子 Dohw0Doh » 2012-09-21 22:52

如果楼主是买的VPS的话, 在服务器上装一个ssl server就行了, 然后在本机ssh登录, 这种方式管理服务器很方便. 也比直接用php脚本来处理更安全.
回复