Skip to content

Commit

Permalink
Merge pull request #262 from sbt/wip/upstart-startup-fix
Browse files Browse the repository at this point in the history
Fixing wrong usage of brackets in upstart script
  • Loading branch information
muuki88 committed May 22, 2014
2 parents 9213b17 + 489473a commit ed929e8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ author "${{author}}"
# See a list of stanzas here: http://upstart.ubuntu.com/wiki/Stanzas#respawn

# When to start the service
start on runlevel [${{start_runlevels}}]
start on started (${{start_facilities}})
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}})
stop on runlevel ${{stop_runlevels}}
stop on stopping ${{stop_facilities}}

# Automatically restart process if crashed. Tries ${{retries}} times every ${{retryTimeout}} seconds
respawn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ author "${{author}}"
# See a list of stanzas here: http://upstart.ubuntu.com/wiki/Stanzas#respawn

# When to start the service
start on runlevel [${{start_runlevels}}]
start on started (${{start_facilities}})
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}})
stop on runlevel ${{stop_runlevels}}
stop on stopping ${{stop_facilities}}

# Automatically restart process if crashed. Tries ${{retries}} times every ${{retryTimeout}} seconds
respawn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ object JavaServerAppPackaging {
private[this] def defaultFacilities(loader: ServerLoader.ServerLoader): String = {
loader match {
case ServerLoader.SystemV => "$remote_fs $syslog"
case ServerLoader.Upstart => "networking"
case ServerLoader.Upstart => "[networking]"
}
}

private[this] def defaultStartRunlevels(loader: ServerLoader.ServerLoader): String = {
loader match {
case ServerLoader.SystemV => "2 3 4 5"
case ServerLoader.Upstart => "2345"
case ServerLoader.Upstart => "[2345]"
}
}

private[this] def defaultStopRunlevels(loader: ServerLoader.ServerLoader): String = {
loader match {
case ServerLoader.SystemV => "0 1 6"
case ServerLoader.Upstart => "016"
case ServerLoader.Upstart => "[016]"
}
}

Expand Down Expand Up @@ -118,7 +118,6 @@ object JavaServerAppPackaging {
},
linuxMakeStartScript in Debian <<= (target in Universal, serverLoading in Debian, linuxScriptReplacements in Debian, linuxStartScriptTemplate in Debian, linuxJavaAppStartScriptBuilder in Debian)
map { (tmpDir, loader, replacements, template, builder) =>
println(replacements)
makeMaintainerScript(builder.startScript, Some(template))(tmpDir, loader, replacements, builder)
},
linuxPackageMappings in Debian <++= (normalizedName, linuxMakeStartScript in Debian, serverLoading in Debian) map startScriptMapping,
Expand Down
4 changes: 2 additions & 2 deletions src/sbt-test/debian/upstart-deb/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ 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("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)
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 ed929e8

Please sign in to comment.