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

changed template for /etc/init/{{app_name}} This seems to fix issue #357... #358

Merged
merged 1 commit into from
Sep 28, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,22 @@ author "${{author}}"

# When to start the service
start on runlevel ${{start_runlevels}}
start on started ${{start_facilities}}

# When to stop the service
stop on runlevel ${{stop_runlevels}}
stop on stopping ${{stop_facilities}}

# Automatically restart process if crashed. Tries ${{retries}} times every ${{retryTimeout}} seconds
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for asking again (and thanks for your patience). You removed these conditions as they won't work when stop_facilities is empty, right? (just guessing). Is there are way to add just "nothing" ? Or aren't they needed at all?

respawn
respawn limit ${{retries}} ${{retryTimeout}}

pre-start script
[ -d /var/run/${{app_name}} ] || install -m 755 -o ${{daemon_user}} -g ${{daemon_user}} -d /var/run/${{app_name}}
end script

# set the working directory of the job processes
chdir ${{chdir}}

# changes to the user and group before running the job's process
setuid ${{daemon_user}}

# Start the process
script
exec ./bin/${{exec}}
exec sudo -u ${{daemon_user}} bin/${{exec}}
end script
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ object JavaServerAppPackaging {
private[this] def defaultFacilities(loader: ServerLoader): String = {
loader match {
case SystemV => "$remote_fs $syslog"
case Upstart => "[networking]"
case Upstart => ""
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this line. This can be changed via the settings requiredStartFacilities and requiredStopFacilities.
The build will then pass.

case Systemd => "network.target"
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/debian/test-executableScriptName/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ debianPackageRecommends in Debian += "git"

TaskKey[Unit]("check-upstart-script") <<= (target, streams) map { (target, out) =>
val script = IO.read(target / "debian-test-0.1.0" / "etc" / "init" / "debian-test.conf")
assert(script.contains("exec ./bin/debian-exec"), "wrong exec call\n" + script)
assert(script.contains("exec sudo -u debian-test bin/debian-exec"), "wrong exec call\n" + script)
out.log.success("Successfully tested control script")
()
}
2 changes: 0 additions & 2 deletions src/sbt-test/debian/upstart-deb/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ InputKey[Unit]("check-softlink") <<= inputTask { (argTask: TaskKey[Seq[String]])
TaskKey[Unit]("check-startup-script") <<= (target, streams) map { (target, out) =>
val script = IO.read(target / "debian-test-0.1.0" / "etc" / "init" / "debian-test.conf")
assert(script.contains("start on runlevel [2345]"), "script doesn't contain start on runlevel header\n" + script)
assert(script.contains("start on started [networking]"), "script doesn't contain start on [networking] header\n" + script)
assert(script.contains("stop on runlevel [016]"), "script doesn't contain stop on runlevel header\n" + script)
assert(script.contains("stop on stopping [networking]"), "script doesn't contain stop on [networking] header\n" + script)
out.log.success("Successfully tested systemV start up script")
()
}