我有一个脚本/etc/init.d/startup ,在那里我做到以下几点: 创build一个应该如下所示的PID文件:/ /var/run/**startup**.pid 执行一个java进程的屏幕,所以我想创build一个名称为startup的屏幕(就像这个屏幕的“dmS 启动 ”脚本的path一样) 在服务器运行的时候,我没有任何问题,但是当它启动时,它会创buildPIDfile和屏幕,其名称不正确: /var/run/**S92startup**.pid 2058.**S92startup** (11/10/2014 03:56:31 PM) (Detached) 如何在启动时指定脚本的名称? (而不是/etc/rc2.d/中的符号链接的名称) 现在我的脚本看起来像这样开始,这就是我得到脚本的名字 SCRNAME=${0##*/} DAEMON="screen -DmS $SCRNAME /srv/startup/scripts/gprs.sh" PIDFILE=/var/run/$SCRNAME.pid PS:它是正确的,当我在服务器上,执行“服务启动启动”,而不是在启动时。
我遇到了一个让我头痛的错误。 试图谷歌,但我发现是关于MySQL不适用于此。 我刚刚在Ubuntu上更新了Node和Ghost(博客平台)。 有一些重大的问题来更新节点,因为它没有以正常的方式安装,所以apt-get没有工作。 我能够安装节点与NVM 。 尝试重新启动服务后,现在显示“作业无法启动” 他们正在使用这个init.d脚本: https : //raw.githubusercontent.com/TryGhost/Ghost-Config/master/init.d/ghost我已经更新为这样的: PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="Ghost" NAME=ghost GHOST_ROOT=/var/www/ghost GHOST_GROUP=ghost GHOST_USER=ghost DAEMON=/root/.nvm/versions/node/v4.2.3/bin/node DAEMON_ARGS="$GHOST_ROOT/index.js" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME export NODE_ENV=production 除此之外,它仍然是一样的。 但是,我不能解决“作业无法启动”部分,即使VERBOSE似乎设置为yes也不会提供任何其他消息。 我已经检查了新的垃圾箱的权限,一切似乎都没问题。 也试图手动运行博客,它似乎工作没有任何错误。 我怎样才能debugging失败的原因?
本页介绍了可以放入System V初始化脚本的标记。 http://mcs.une.edu.au/doc/initscripts/sysvinitfiles 在RHEL5中,chkconfig将parsingchkconfig标签。 # chkconfig: 2345 20 80 在RHEL5中,还有哪些工具parsing和利用其他标签? 在我的脚本中使用processname , pidfile或config标记processname什么好处?
我已经在linux服务器上创build了我的第一个初始化脚本(如果添加了任何信息的话,ubuntu会检查更新,下载并在每个小时执行一次)。 init文件如下: /etc/init/updater.conf start on (filesystem and stopped udevtrigger) stop on runlevel [06] console output respawn script chvt 6 chvt 7 while true; do # code to check update … if [ should_update ]; then # Download the script chmod +x /path/to/script.sh bash /path/to/script.sh rm /path/to/script.sh fi echo 'Rechecking for updates in 1h…' sleep 1h […]
我试图让一个Bukkit服务器作为一个服务在屏幕上运行,从一个LSB脚本启动,但我不能让它停止正确。 我基本上希望它做的是重新挂接屏幕并发送一个“停止”命令到服务器控制台,所以它保存了一切,而不是被杀死,但“sudo服务bukkit停止”似乎没有做任何事情与我的脚本。 如果我在terminal重新连接屏幕,并在“Bukkit”控制台上input“stop”,它似乎仍然停止。 任何人都知道问题是什么? 我的init.d脚本如下… #!/bin/bash ### BEGIN INIT INFO # Provides: scriptname # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start daemon at boot time # Description: Enable service provided by daemon. ### END INIT INFO cd /etc/minecraftbukkit case $1 in […]
我目前在RHEL6系统上从源代码安装PostgreSQL。 我通常一直在遵循官方文件的指导( http://www.postgresql.org/docs/9.4/static/installation.html )。 不幸的是,通过init.d /启动脚本没有太多的信息。 这是我目前正在挣扎的: OOB启动脚本( https://github.com/postgres/postgres/blob/master/contrib/start-scripts/linux )会被复制到/etc/init.d/postgres并稍作修改以反映我的环境(例如前缀,数据path等); 文件由root拥有,拥有755个权限 以root身份执行以下命令以确保在启动时执行:chkconfig –add postgresql; chkconfig postgresql on; 作为根,脚本运行没有问题(例如/etc/init.d/postgresql状态) 但是,脚本在作为postgres用户(configuration为运行PostgreSQL的用户)执行时会返回密码提示, 这种体验与PostgreSQL函数的打包版本(即RPM)有很大的不同。 我能够以root身份和postgres身份执行脚本: [root@ulvjived80 ~]# /etc/init.d/postgresql-9.4 status postgresql-9.4 is stopped [postgres@ulvjived80 ~]$ /etc/init.d/postgresql-9.4 status postgresql-9.4 is stopped 我在网上做了不less的search,我发现的最引用的解决scheme涉及到在/ etc / sudoers文件中允许相关用户的命令/脚本。 但是,RPM似乎没有这样做。 我们使用的商业应用程序的行为也是相同的,即启动脚本可以由root用户和相关的非root用户执行。 有什么想法可以模仿RPMsfunction吗? 谢谢!
我有以下configuration来增加可用于所有用户的进程的文件描述符的数量。 cat /etc/security/limits.conf * hard nofile 65536 * soft nofile 65536 当机器启动时,nginx设置为在nginx用户下作为服务启动,如果我检查/ proc //限制下的限制,它是1024/4096 Max open files 1024 4096 files 在不更改任何设置或configuration文件的情况下,如果我使用sudo service nginx restart nginx服务 限制可达65536/65536 Max open files 65536 65536 files 无论如何,要确保它第一次启动这些限制?
我有一个代理服务器,一切ok。 但是,我有一些问题和疑问。 第一:当我做“/etc/init.d/nginx停止”或“/etc/init.d/nginx restart”,我的configuration,它不会重新加载,所有的nginx进程不会被杀死。 我的脚本: case "$1" in start) echo Starting nginx cd /usr/local/nginx/ wget https://www.dropbox.com/s/qweqwrqwrqwraqwe/nginx.cfg?dl=0 -O nginx.cfg /usr/local/nginx/nginx /usr/local/nginx/nginx.cfg RETVAL=$? echo [ $RETVAL ] ;; stop) echo Stopping nginx if [ /usr/local/nginx/nginx.pid ]; then /bin/kill `cat /usr/local/nginx/nginx.pid` else /usr/bin/killall nginx fi RETVAL=$? echo [ $RETVAL ] ;; restart|reload) echo Reloading nginx if [ /usr/local/nginx/nginx.pid […]
我试图在networking和DNS启动并运行后在Debian 8上启动一个init.d守护进程。 这是我正在使用的脚本: ### BEGIN INIT INFO # Provides: local_daemon # Required-Start: $all $local_fs $remote_fs $network $named $time $syslog # Required-Stop: $all $local_fs $remote_fs $network $named $time $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts a Daemon. # Description: Starts a custom daemon. ### END INIT INFO 我有几台服务器,这大部分工作。 […]
我正在尝试在centos 6.8上为prometheus运行node_exporter。 这是我能够创build的init.d脚本: #!/bin/sh ### BEGIN INIT INFO # Provides: Node exporter # Required-Start: $local_fs $network $named $time $syslog # Required-Stop: $local_fs $network $named $time $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Description: Node exporter for prometheus written in Go ### END INIT INFO DAEMON=/home/prometheus/node_exporter-0.14.0.linux-amd64 NAME=node_exporter USER=prometheus PIDFILE=/var/run/prometheus/$NAME.pid LOGFILE=/var/log/prometheus/$NAME.log […]