Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix SystemV init script template for rpm packaging #541

Merged
merged 2 commits into from
Apr 5, 2015

Conversation

dwhjames
Copy link
Contributor

@dwhjames dwhjames commented Apr 4, 2015

Main fix is to make use of the daemon library function in start, correcting broken invocation of runuser.

For processes that manage their own pid file, they should define the PIDFILE variable (sourced either through /etc/default/… or /etc/sysconfig/…). Otherwise, if undefined, this script will capture the pid and write it to /var/run/${{app_name}}/running.pid.

Other minor changes:

  • don’t need to call success/failure in start as this is already done by daemon
  • don’t need to create /var/run/${{app_name}} dir as this is already done by the linux package mappings and thus the dir is created at package install time.

Main fix is to make use of the `daemon` library function in `start`, correcting broken invocation of `runuser`.

For processes that manage their own pid file, they should define the `PIDFILE` variable (sourced either through `/etc/default/…` or `/etc/sysconfig/…`). Otherwise, if undefined, this script will capture the pid and write it to `/var/run/${{app_name}}/running.pid`.

Other minor changes:

- don’t need to call `success`/`failure` in `start` as this is already done by `daemon`
- don’t need to create `/var/run/${{app_name}}` dir as this is already done by the linux package mappings and thus the dir is created at package install time.
@dwhjames
Copy link
Contributor Author

dwhjames commented Apr 4, 2015

@muuki88, I’ve tested this with Centos 6.6 and a sample Play app. I can package up my semi-automated test environment and submit it as a PR, if you’d like.

I’ve tested the script in the two cases with respect to pid file creation.

First with the following in the /etc/default/…

JAVA_OPTS="-Dpidfile.path=/var/run/${{app_name}}/play.pid $JAVA_OPTS"
PIDFILE="/var/run/${{app_name}}/play.pid"

In this case, this value of PIDFILE is used by daemon, kill_proc, and status.

In the second case, I left PIDFILE undefined, which results in the init script setting

PIDFILE="/var/run/${{app_name}}/running.pid"

and appending echo $! > $PIDFILE to the command run by daemon.

$prog is undefined at this point
@@ -22,7 +22,11 @@
# -----------------
# JAVA_OPTS="-Dpidfile.path=/var/run/${{app_name}}/play.pid $JAVA_OPTS"

# Setting PIDFILE
# ---------------
# PIDFILE="/var/run/${{app_name}}/play.pid"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getting the config stuff right already paid off. Sweet!

@muuki88
Copy link
Contributor

muuki88 commented Apr 4, 2015

I will give this a try hopefully in the next days. Really appreciate your work. Thanks :)

@dwhjames
Copy link
Contributor Author

dwhjames commented Apr 4, 2015

Thanks! It’s been a good opportunity to brush up on Linux and Bash.

muuki88 added a commit that referenced this pull request Apr 5, 2015
fix SystemV init script template for rpm packaging
@muuki88 muuki88 merged commit a243197 into sbt:master Apr 5, 2015
@muuki88 muuki88 mentioned this pull request Jun 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants