Articles of init.d

我的init.d脚本永远不会调用停止参数?

我创build了一个名为blueBoxT的脚本来启动和停止Oracle,并将其放置在/etc/init.d目录中。 #!/bin/bash echo "blueBoxT $1 – `date '+%Y%m%d%H%M'`" >> /root/blueBoxT.log case "$1" in 'start') echo "Starting Oracle" su – oracle -c "/home/oracle/startDBT" ;; 'stop') echo "Stopping Oracle" su – oracle -c "/home/oracle/stopDBT" ;; *) echo "`basename $0`: usage: `basename $0` { stop | start }" ;; esac exit 0 我做了象征性的链接 root@dev /etc/rc.d # find . […]

elasticsearch @ debian6由/etc/init.d max_file_descriptors启动

我已经通过本教程安装了elasticsearch @ debian6。 我已经build立了我的系统最大打开文件指令,所以我有这些值: # su # cat /proc/sys/fs/file-max 70000 # ulimit -Hn 64000 # ulimit -Sn 32000 当我检查elasticsearch max_file_descriptors: curl -XGET 'http://localhost:9200/_nodes?process=true&pretty=true' 我会得到1024 。 当我用root用户重新启动它时,它现在有“max_file_descriptors”:64000。 那个init.d autostart有什么问题? 当我检查htop时,由init.d用这个1024个描述符自动启动的弹性在root用户下也是runnig。 我已经设置最大的文件打开2 confs: cat /etc/sysctl.conf … fs.file-max = 70000 cat /etc/security/limits.conf … * soft nofile 32000 * hard nofile 64000 root soft nofile 32000 root hard nofile […]

在Ubuntu / Debian中RH / CentOS服务&chkconfig等价物

在RedHat / CentOS发行版中,使用/sbin/service启动和停止/sbin/service : /sbin/service httpd reload 您可以设置它们是否应该在/sbin/chkconfig启动时运行: /sbin/chkconfig –levels 2345 on 基于Debian的发行版(如Ubuntu)有什么等价物?

使用`grep`来检查init脚本文件中是否存在string是否可以接受?

我可以在init脚本中用grep检查给定string的文件内容吗? 我担心引入依赖关系和一般约定,当涉及到init脚本时,如果运行grep或其他工具违反了一些信条。

通过start-stop-daemon启动提供openconnect密码

我试图通过使用start-stop-daemon的Debian init脚本启动openconnect : DAEMON=/usr/sbin/openconnect DAEMON_ARGS="<endpoint> –script /etc/vpnc/vpnc-script –user <user> –pid-file $PIDFILE –passwd-on-stdin" PASSWORD=`cat /etc/openconnect/<endpoint>.passwd` start-stop-daemon –start –pidfile "$PIDFILE" –exec "$DAEMON" — $DAEMON_ARGS <<< ${PASSWORD} 不幸的是,openconnect在启动过程中仍然会提示input密码,因为它似乎无法读取redirect到stdin的密码。 有任何想法吗?

Systemd导致多个主pipe进程

我有一个问题缩小问题是我的主pipeconfiguration,导致程序被复制。 我正在通过Nginx反向代理运行Python Tornado Web服务器。 不过,我认为这个问题更多的与主pipe有关。 /etc/supervisor/supervisord.conf [unix_http_server] file=/var/run/supervisor.sock chmod=0700 [supervisord] logfile=/var/log/supervisor/supervisord.log pidfile=/var/run/supervisord.pid childlogdir=/var/log/supervisor logfile_maxbytes=50MB logfile_backups=5 loglevel=error [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [supervisorctl] serverurl=unix:///var/run/supervisor.sock [include] files = /etc/supervisor/conf.d/*.conf /etc/supervisor/conf.d/tornado.conf [program:tornado] numprocs = 4 numprocs_start = 8000 process_name = %(program_name)s_%(process_num)02d directory=/home/username/webapp environment=PATH="/home/username/.virtualenvs/tornado_env/bin" command = python server.py –port=%(process_num)s user=www-data redirect_stderr=true stdout_logfile=/var/log/webapp/%(program_name)s_%(process_num)02d.log loglevel=info 正如你可以看到numprocs = 4 ,但是在刚刚重启服务器之后,我的困惑就来自于这个。 ps -aux | […]

是否可以设置一个Upstart服务来停止$ LAST

我希望rsyslog服务运行到最后一刻,以确保我们在中央日志logging服务器上尽可能多地接收日志logging。 在Ubuntu 11.04上,rsyslog的停止行被设置为“stop on runlevel [06]”,以便在至less(通过rc0.d / K脚本停止)服务之前停止。 我怎样才能达到相当于/etc/rc0.d/K99rsyslog?

只有在另一个服务完全启动后才能启动服务(在CentOS上)

我在CentOS服务器上安装了postgresql服务,另外一个名为netnfork 。 'netnfork'服务只有在postgresql启动后才会启动。 netnfork初始化脚本: #!/bin/sh # # netnfork init # # chkconfig: 2345 99 15 # description: netnfork … 从netnfork的初始化脚本,你可以看到启动顺序是99。 postgresql初始化脚本: #!/bin/sh # # postgresql This is the init script for starting up the PostgreSQL # server. # # chkconfig: – 64 36 # description: PostgreSQL database server. … 从postgresql的init脚本中可以看到,启动顺序是64. 问题在于,由于postgresql服务没有完全启动, netnfork服务无法启动。 我知道从日志文件 。 你有解决这个问题的办法吗? […]

启动脚本的问题

我试图让Chandler在用户的“chandler”下启动时在debian框上运行,并尝试了下面的脚本,在init.d中find它: #! /bin/sh # # /etc/init.d/chandler # RETVAL=$? CHANDLER_HOME="/chandler" # check input case "$1" in start) if [ -f $CHANDLER_HOME/bin/osafsrvctl ]; then /bin/su chandler $CHANDLER_HOME/bin/osafsrvctl start fi ;; stop) if [ -f $CHANDLER_HOME/bin/osafsrvctl ]; then /bin/su chandler $CHANDLER_HOME/bin/osafsrvctl stop fi ;; *) echo "Usage: /etc/init.d/osafsrvctl {start|stop}" exit 1 ;; esac exit $RETVAL 然后我跑了: update-rc.d chandler […]

无法让Nginx开始与Ubuntu启动

我正在运行从源代码编译的Ubuntu 12.04和Nginx 1.2.1 。 我尝试了下面的命令让nginx在启动时启动: $ sudo update-rc.d nginx default $ sudo update-rc.d nginx enable 2345 在这两种情况下,我收到以下错误: update-rc.d: warning: nginx start runlevel arguments (none) do not match LSB Default-Start values (2 3 4 5) update-rc.d: warning: nginx stop runlevel arguments (none) do not match LSB Default-Stop values (0 1 6) 我不明白的是我的/etc/init.d/nginx脚本似乎有正确的init信息: #!/bin/sh ### BEGIN INIT […]