我写了一个脚本,通过滑动synclient的输出来确定一台笔记本电脑的触摸板是否奇迹般地自行closures(Ubuntu似乎最近/最近这样做),如果是这样,就把它重新打开。 脚本是这样的: #!/bin/bash while true ; do if [ `synclient | grep -e"TouchpadOff[\s]*1" | wc -l` -ge 1 ] ; then synclient TouchpadOff=0 fi sleep(3) done (我现在没有笔记本电脑,但是你明白了!当我在我的笔记本电脑上时,我会稍后更新,如果这是不正确的) 所以我尝试运行这个作为一个暴发户脚本,所以我的触摸板可以愈合自己没有任何交互。 但似乎synclient没有find当前用户的X会话,当我的脚本启动。 我尝试在我的脚本节中使用su -c myscript.sh ledneb类的东西来运行它,但无济于事。 我应该在/ etc / X11 / xinit / xinitrc而不是新贵的方向看吗? 有没有一个正确的方法让这个脚本运行在当前(甚至硬编码)用户的x会话的上下文中?
我做了apt-get更新,并在运行10.04LTS的服务器上安装了几个更新。 但是这已经破坏了MySQL。 它不会在启动时启动。 我试图手动启动它使用以下命令: $ sudo /etc/init.d/mysql restart Rather than invoking init scripts through /etc/init.d, use the service(8) utility, eg service mysql restart Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the restart(8) utility, eg restart mysql start: Job failed to start $ sudo […]
这可能有一个简单的解释,但我当然想不起来。 我已经安装了corosync(通过yum),它是默认的init脚本。 在这个特殊的CentOS安装中有些奇怪,因为我经常需要手动链接/etc/rc.d/init.d/到/etc/init.d。 问题是通过它的符号链接运行失败,但它通过/etc/rc.d/init.d运行良好 更奇怪的是,如果使用完整path运行,并且仅在实际运行在/etc/rc.d/init.d目录下,则运行失败。 例: [~]# /etc/rc.d/init.d/corosync start Starting Corosync Cluster Engine (corosync): [FAILED] [~]# service corosync status corosync is stopped [~]# cd /etc/rc.d/init.d/ [init.d]# /etc/rc.d/init.d/corosync start Starting Corosync Cluster Engine (corosync): [FAILED] [init.d]# corosync start [init.d]# service corosync status corosync (pid 1985) is running… 任何解释? 编辑: 不知道我改变了什么,但现在从/rc.d/init.d开始工作,但是没有启动service corosync。 [root@server2 mirror]# /etc/rc.d/init.d/corosync start Starting […]
我需要编写一个脚本,在发生错误时向用户提示信息。 这可能使用/etc/init.d scripts + update-rc.d ? 有没有其他的方法?
我正在使用CentOS 6.2。 我试图从init.d脚本启动Hadoop,但是失败了。 这是我在boot.log中看到的: Retrigger failed udev events [ OK ] Enabling Bluetooth devices: starting namenode, logging to /home/hadoop/hadoop/hadoop-0.20.2/bin/../logs/hadoop–namenode-localhost.localdomain.out localhost: ssh: connect to host localhost port 22: Connection refused localhost: ssh: connect to host localhost port 22: Connection refused starting jobtracker, logging to /home/hadoop/hadoop/hadoop-0.20.2/bin/../logs/hadoop–jobtracker-localhost.localdomain.out localhost: ssh: connect to host localhost port 22: Connection refused Starting […]
我用2000个虚拟主机重新启动Apache时遇到一些问题。 我在CentOS 5.8 64位上使用Apache 2.2.22 + PHP 5.4.6。 当我尝试重新启动它显示这个: /etc/init.d/httpd restart Stopping httpd: [FAILED] Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs [FAILED] 当我做killall -9 httpd它确定然后一段时间,然后再次发生:/
我为我的lxc服务器下载了一个openvz模板来创build一个新的centos 6.3 guest。 现在客户没有启动,因为udev挂在启动过程中。 上次我没有这个问题,但现在我必须禁用或从客人删除udev。 如何才能做到这一点?
我想知道创build一个好的脚本来启动/停止/重启一些服务是一个很好的实践。 我会尽量让自己更清楚,好吗? 现在,我做这样的事情:假设我想创build一个脚本来start/stop/restart一个服务,所以我创build一个文件夹/company/service name/然后把start.sh和stop.sh ,这是这样的: start.sh #!/bin/bash #VARIABLES SERVICE_NAME="<service name>" USERDEPLOYER="<service name>_deployer" FOLDER=/company/<service name>/ KEYWORD="<keyword>" # #CHECKING SYSTEM STATUS PROC=`ps -ef | grep $SERVICE_NAME | grep $KEYWORD | grep -v grep | awk -F" " '{ print $2 }'`; if [ $PROC ]; then echo "$SERVICE_NAME is running!" echo "Stop then first!" exit fi ### […]
如何在Debian Squeeze中自动重新启动用户xy后启动python script.py?
原谅我,因为这是我第一次尝试为centos 5写一个init脚本。 我正在使用django +主pipe来pipe理我的芹菜工作者,调度员。 现在,这是我天真简单的尝试/etc/init.d/supervisor #!/bin/sh # # /etc/rc.d/init.d/supervisord # # Supervisor is a client/server system that # allows its users to monitor and control a # number of processes on UNIX-like operating # systems. # # chkconfig: – 64 36 # description: Supervisor Server # processname: supervisord # Source init functions /home/foo/virtualenv/property_env/bin/python /home/foo/bar/manage.py supervisor […]