Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
Jupyter Docker Stacks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Jupyter Docker Stacks
Commits
459e68c2
Commit
459e68c2
authored
Sep 03, 2018
by
Peter Parente
Committed by
GitHub
Sep 03, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #688 from rkdarst/pre-start-hook
Add a posibliity for a pre-start hook
parents
8ccdfc1d
6fa9a4a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
16 deletions
+29
-16
base-notebook/start.sh
base-notebook/start.sh
+29
-16
No files found.
base-notebook/start.sh
View file @
459e68c2
...
@@ -11,22 +11,33 @@ else
...
@@ -11,22 +11,33 @@ else
cmd
=
$*
cmd
=
$*
fi
fi
for
f
in
/usr/local/bin/start-notebook.d/
*
;
do
run-hooks
()
{
case
"
$f
"
in
# Source scripts or run executable files in a directory
*
.sh
)
if
[[
!
-d
"
$1
"
]]
;
then
echo
"
$0
: running
$f
"
;
.
"
$f
"
return
;;
fi
*
)
echo
"
$0
: running hooks in
$1
"
if
[
-x
$f
]
;
then
for
f
in
"
$1
"
/
*
;
do
echo
"
$0
: running
$f
"
case
"
$f
"
in
$f
*
.sh
)
else
echo
"
$0
: running
$f
"
echo
"
$0
: ignoring
$f
"
source
"
$f
"
fi
;;
;;
*
)
esac
if
[[
-x
"
$f
"
]]
;
then
echo
echo
"
$0
: running
$f
"
done
"
$f
"
else
echo
"
$0
: ignoring
$f
"
fi
;;
esac
echo
"
$0
: done running hooks in
$1
"
done
}
run-hooks /usr/local/bin/start-notebook.d
# Handle special flags if we're root
# Handle special flags if we're root
if
[
$(
id
-u
)
==
0
]
;
then
if
[
$(
id
-u
)
==
0
]
;
then
...
@@ -89,6 +100,7 @@ if [ $(id -u) == 0 ] ; then
...
@@ -89,6 +100,7 @@ if [ $(id -u) == 0 ] ; then
# Exec the command as NB_USER with the PATH and the rest of
# Exec the command as NB_USER with the PATH and the rest of
# the environment preserved
# the environment preserved
run-hooks /usr/local/bin/before-notebook.d
echo
"Executing the command:
$cmd
"
echo
"Executing the command:
$cmd
"
exec sudo
-E
-H
-u
$NB_USER
PATH
=
$PATH
XDG_CACHE_HOME
=
/home/
$NB_USER
/.cache
PYTHONPATH
=
$PYTHONPATH
$cmd
exec sudo
-E
-H
-u
$NB_USER
PATH
=
$PATH
XDG_CACHE_HOME
=
/home/
$NB_USER
/.cache
PYTHONPATH
=
$PYTHONPATH
$cmd
else
else
...
@@ -132,6 +144,7 @@ else
...
@@ -132,6 +144,7 @@ else
fi
fi
# Execute the command
# Execute the command
run-hooks /usr/local/bin/before-notebook.d
echo
"Executing the command:
$cmd
"
echo
"Executing the command:
$cmd
"
exec
$cmd
exec
$cmd
fi
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment