Skip to content

Commit

Permalink
Merge pull request #439 from sbt/fix/rpm-postun
Browse files Browse the repository at this point in the history
FIX #435 Adding loader and control functions
  • Loading branch information
muuki88 committed Dec 16, 2014
2 parents 353a11a + 610fa1c commit 47692e1
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
${{loader-functions}}
${{control-functions}}

addGroup ${{daemon_group}}
addUser ${{daemon_user}} ${{daemon_group}} "${{app_name}} user-daemon" "${{daemon_shell}}"

startService ${{app_name}} || echo "${{app_name}} could not be registered or started"
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
${{control-functions}}

# Removing system user/group : ${{daemon_user}} and ${{daemon_group}}

# Scriptlet syntax: http://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Syntax
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
${{control-functions}}

# Adding system user/group : ${{daemon_user}} and ${{daemon_group}}
if ! getent group | grep -q "^${{daemon_group}}:" ;
then
echo "Creating system group: ${{daemon_group}}"
groupadd --system ${{daemon_group}}
fi
if ! getent passwd | grep -q "^${{daemon_user}}:";
then
echo "Creating system user: ${{daemon_user}}"
useradd --gid ${{daemon_group}} --no-create-home --system -c '${{app_name}} daemon-user' ${{daemon_user}}
fi

addGroup ${{daemon_group}}
addUser ${{daemon_user}} ${{daemon_group}} "${{app_name}} user-daemon" "${{daemon_shell}}"
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
${{loader-functions}}

# Halting ${{app_name}}
echo "Shutdown ${{app_name}}"
service ${{app_name}} stop || echo "Could not stop ${{app_name}}"
2 changes: 1 addition & 1 deletion test-project-simple/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ libraryDependencies ++= Seq(

mainClass in Compile := Some("ExampleApp")

enablePlugins(JavaAppPackaging, JDebPackaging)
enablePlugins(JavaServerAppPackaging, JDebPackaging)

maintainer := "Josh Suereth <[email protected]>"
packageSummary := "Minimal Native Packager"
Expand Down
16 changes: 15 additions & 1 deletion test-project-simple/src/main/scala/ExampleApp.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
import java.util.concurrent._

object ExampleApp extends App {

println("Hello, world!")
val executorService = Executors newFixedThreadPool 2

while (true) {
for(i <- 0 to 5) executorService execute HelloWorld(i)
Thread sleep 5000
}

}

case class HelloWorld(i: Int) extends Runnable {
def run() {
println(s"[$i] Hello, world!")
}
}
2 changes: 2 additions & 0 deletions test-project-simple/src/templates/etc-default
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-J-Xms64m
-J-Xmx128m

0 comments on commit 47692e1

Please sign in to comment.