-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ddd51e
commit 97f41a0
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
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,24 @@ | ||
#!/bin/bash | ||
|
||
cleanup() { | ||
kill -TERM 1 | ||
} | ||
|
||
# Wait for the rsession process to start | ||
while ! pgrep -x "rsession" > /dev/null; do | ||
sleep 1 | ||
done | ||
|
||
# Monitor the rsession process | ||
while true; do | ||
if pgrep -x "rsession" > /dev/null; then | ||
sleep 1 | ||
else | ||
# If the rsession process is not running for more than 10 seconds, terminate the container | ||
# Restarting R session shouldn't take more than 10 seconds | ||
sleep 10 | ||
if ! pgrep -x "rsession" > /dev/null; then | ||
cleanup | ||
fi | ||
fi | ||
done |
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 @@ | ||
session-timeout-minutes=30 |