New answers tagged init.d
So, you're trying to replace a script that starts a long-running java command in the background with one that runs it in screen? I think there are actually two problems with your screen attempt. First off, that screen command won't exit/background until the java command is finished (or an interactive user types some things). Secondly, $! isn't really going ...
Not 100% sure I understand your question, but lets try : $! would work from the parentshell, not from inside the child process $! is for a background process, screen is not exactly a background process Also screen -S will not detach the screen, you probably need more screen options you probably want something like screen -dmS also from inside the ...
Have you looked at other init scripts for reference? Let's go through this section by section. First let's name a shell to be executed. Ok. #!/bin/sh Now please put LSB tags there as the init system suggests (tells the init system the dependencies) ### BEGIN INIT INFO # Provides: someserver # Required-Start: $syslog $network $remote_fs # ...
In the end, after taking down everything that can be brought down nicely, everything remaining receives a "kill -9".
If you watch your shutdown process carefully, you will see, after virtually everything has been done, that init will kill anything that's still running. On a Red Hat/CentOS 6 system you'll see: Sending all processes the TERM signal... followed a few seconds later by Sending all processes the KILL signal... Anything that had not been shut down by then ...
It's not that the path is changed during init, rather it's that normal shells get a different environment. See http://www.tldp.org/HOWTO/Path-4.html for an explanation. Either set the path explicitly at the top of your script or create a new script to set the path and source that at the top of scripts that need the changed environment.
I found that the function was sourced from /lib/lsb/init-functions in the nginx init script. So adding: . /lib/lsb/init-functions To my init script solved the problem.
I ended up posting about the issue on the github page for the project, and I got quite a speedy response pointing me to another issue which came along with another init script, which I have now implemented. This seems to work correctly. Thanks to TrevorH in the CentOS IRC channel for the assitance, as well as driskell on github for getting me to the new ...
Sounds like logstash-forwarder is not properly being stopped/killed during the shutdown process. Have you manually tried to logstash-forwarder using the init script, and see how long it actually takes for the daemon to be fully stoped? Are the logs logstash-forwarder is tracking in your CentOS 5 machine, large log files compared to what your CentOS 6 ...
Top 50 recent answers are included