BASH: Shell Script as Init Script -
BASH: Shell Script as Init Script -
i have shell script calls java jar file , runs application. there's no way around this, have work have.
when execute shell script, outputs application status , sits there (pretty much console); when happens programme updates screen. normal non daemonized/backgrounded process. way out of ctrl-c, ends process altogether. know around doing path_to_shell_script/script.sh &
, background session (i utilize nohup if wanted logout).
my issue is, don't know how set script init script. have of init script written, when seek daemonize it, doesn't work. i've got working, however, when run initscript, spans same "console" on script, , sits there until nail ctrl-c. here's line in question:
daemon ${basedir}/$prog && success || failure
the problem can't background daemon ${basedir}/$prog
part , think that's i'm running issue. has been successful @ creating init script shell script? shell script not daemonizable (you can background it, underlying programme not back upwards daemonize option, or else have allow application work).
you need open subshell execute it. help redirect output file, or @ to the lowest degree /dev/null.
something like:
#!/bin/bash ( { daemon ${basedir}/$prog && success || failure ; } &>/dev/null ) & exit 0
it work follows ( list ) & in background subshell. { list } grouping command, it's used here capture output of commands , send /dev/null.
bash shell daemon init
Comments
Post a Comment