File size: 426 Bytes
db5855f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

set -x

if [ $# -eq 0 ]; then
    echo "Executing the command: bash"
    exec bash
else
    echo "Executing the command: $@"

    if [[ -z "${JUPYTER_ENABLE_SUPERVISORD}" ]]; then
        trap 'kill -TERM $PID' TERM INT

        "$@" &

        PID=$!
        wait $PID
        trap - TERM INT
        wait $PID
        STATUS=$?
        exit $STATUS
    else
        exec "$@"
    fi
fi