Articles of init

需要自定义init脚本的帮助

我正在尝试为redhat linux上的进程设置一个初始化脚本: #!/bin/sh # # Startup script for Conquest # # chkconfig: 345 85 15 – start or stop process definition within the boot process # description: Conquest DICOM Server # processname: conquest # pidfile: /var/run/conquest.pid # Source function library. This creates the operating environment for the process to be started . /etc/rc.d/init.d/functions CONQ_DIR=/usr/local/conquest case […]

Fedora init启动顺序

我对Linux Fedora的启动顺序感兴趣,特别是从用户空间初始化序列开始。 这方面的信息有什么好的来源?

/ etc / inittab respawn脚本从RHEL / CentOS 5.x迁移到6.x

我在CentOS 5.7中有一个非分叉的perl脚本作为TCP-sockets守护进程运行(这个脚本是多人游戏的后端)。 它正在被/ etc / inittab启动和重新生成: pref:3:respawn:/bin/su -c '/usr/local/pref/pref.pl >/tmp/pref-`date +%a`.txt 2>&1' afarber 它正在每天晚上由cronjob重新启动: 33 1 * * * kill `cat /tmp/pref.pid` (其中/tmp/pref.pid文件是由脚本本身创build的)。 这个设置对我来说很好,因为很多卫星。 现在我正在尝试升级到CentOS 6.x,并在阅读“man 5 init”之后创build了一个新的/etc/init/pref.conf文件: start on stopped rc RUNLEVEL=3 stop on starting rc RUNLEVEL=[!3] console output respawn chdir /tmp exec /bin/su -c '/usr/local/pref/pref.pl >/tmp/pref-`date +%a`.txt 2>&1' afarber 并可以启动它 # sudo initctl […]

在cloud-init脚本中运行sudo命令

我正在为一些服务器开发自动引导程序,因为我们正在使用Amazon EC2作为我们的基础架构。 我所做的是:运行连接到EC2的Fabric脚本,并初始化一个新实例,将用户数据放入一个cloud-init脚本。 该脚本检出包含Fabric任务的Mercurial项目,然后在签出后,脚本将找出正在运行的服务器的types并执行特定的本地Fabric任务。 我的问题是有些任务需要运行sudo命令,因为脚本是从cloud-init初始化的,所以发生sudo警告需要运行一个tty,我试图修改它来运行su –session-command="my commands to restart services" root ,它不(似乎不应该)根本无法工作。 那么,如何在这个启动脚本中运行sudo命令呢? 一些代码: cloud_init_script: #!/bin/sh su –session-command="\ source /etc/profile; \ cd /home/my_user; \ hg clone ssh://fabric_tasks_repo fabric; \ /usr/local/bin/fab -f /home/my_user/fabric/fabfile.py \`ec2-describe-tags –filter \"resource-type=instance\" –filter \"resource-id=$(ec2-metadata -i | cut -d ' ' -f2)\" –filter \"key=type\" | cut -f5\` > /home/my_user/fabric.log 2>&1" my_user & /usr/local/bin/fab行的技巧是运行一些ec2脚本来检查服务器所在的标记键“type”。

Ubuntu服务器:在启动时运行进程

如何使Ubuntu服务器在启动时按特定顺序运行服务? 我已经读了一些关于Upstart , init.d和inittab ,我不确定这样做的正确方法是什么。 谢谢, 乌迪

我的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 . […]

init.d /脚本Fedora的解释

下面是vsftpd的一个副本,我需要一些在这个脚本中提到的一些脚本的解释: #!/bin/bash # ### BEGIN INIT INFO # Provides: vsftpd # Required-Start: $local_fs $network $named $remote_fs $syslog # Required-Stop: $local_fs $network $named $remote_fs $syslog # Short-Description: Very Secure Ftp Daemon # Description: vsftpd is a Very Secure FTP daemon. It was written completely from # scratch ### END INIT INFO # vsftpd This shell script […]

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

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

如何自动产卵php-cgi退出时?

我在ubuntu(使用nginx)上使用php-cgi,并且启动它的命令是: spawn -fcgi -a 127.0.0.1 -p 9100 -f / usr / bin / php-cgi -P /var/run/fastcgi-php.pid 但有时php-cgi进程会自动退出,我需要手动启动它。 有什么办法可以使其自动重启,例如)编写init脚本? 请build议,谢谢。

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

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