-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #439 from sbt/fix/rpm-postun
FIX #435 Adding loader and control functions
- Loading branch information
Showing
7 changed files
with
27 additions
and
16 deletions.
There are no files selected for viewing
4 changes: 0 additions & 4 deletions
4
src/main/resources/com/typesafe/sbt/packager/archetypes/java_server/rpm/postinst-template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
2 changes: 2 additions & 0 deletions
2
src/main/resources/com/typesafe/sbt/packager/archetypes/java_server/rpm/postun-template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 5 additions & 10 deletions
15
src/main/resources/com/typesafe/sbt/packager/archetypes/java_server/rpm/preinst-template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}}" |
2 changes: 2 additions & 0 deletions
2
src/main/resources/com/typesafe/sbt/packager/archetypes/java_server/rpm/preun-template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-J-Xms64m | ||
-J-Xmx128m |