Skip to content

Commit

Permalink
Merge pull request #358 from flowma/master
Browse files Browse the repository at this point in the history
changed template for /etc/init/{{app_name}} This seems to fix issue #357...
  • Loading branch information
muuki88 committed Sep 28, 2014
2 parents 72594d7 + ba03b31 commit b43d10c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
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
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 => ""
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")
()
}

0 comments on commit b43d10c

Please sign in to comment.