diff --git a/start_vscode.sh b/start_vscode.sh
index fdde34a863dd683d74ae6cc8dd21a33ec78886c5..ed0e972d5ce7884a502e0fc835cec95b6d63e013 100755
--- a/start_vscode.sh
+++ b/start_vscode.sh
@@ -297,8 +297,8 @@ ENDSSH
 
 # run the code-server job on Euler and save the ip of the compute node in the file vscip in the home directory of the user on Euler
 echo -e "Connecting to $VSC_HOSTNAME to start the code-server in a batch job"
-# FIXME: save jobid in a variable, that the script can kill the batch job at the end
-ssh $VSC_SSH_OPT bsub -n $VSC_NUM_CPU -W $VSC_RUN_TIME -R "rusage[mem=$VSC_MEM_PER_CPU_CORE]" $VSC_SNUM_GPU  <<ENDBSUB
+
+ssh $VSC_SSH_OPT bsub -n $VSC_NUM_CPU -W $VSC_RUN_TIME -R "rusage[mem=$VSC_MEM_PER_CPU_CORE]" $VSC_SNUM_GPU > BJOB_ID_FILE<<ENDBSUB
 module load $VSC_MODULE_COMMAND
 export XDG_RUNTIME_DIR="\$HOME/vsc_runtime"
 VSC_IP_REMOTE="\$(hostname -i)"
@@ -306,6 +306,9 @@ echo "Remote IP:\$VSC_IP_REMOTE" >> /cluster/home/$VSC_USERNAME/vscip
 code-server --bind-addr=\${VSC_IP_REMOTE}:8899
 ENDBSUB
 
+BJOB_ID=$(cat BJOB_ID_FILE | awk '{print $2}'| sed 's/[><]//g')
+rm BJOB_ID_FILE
+
 # wait until batch job has started, poll every $VSC_WAITING_INTERVAL seconds to check if /cluster/home/$VSC_USERNAME/vscip exists
 # once the file exists and is not empty the batch job has started
 ssh $VSC_SSH_OPT <<ENDSSH
@@ -354,6 +357,7 @@ Remote port       : $VSC_REMOTE_PORT
 Local port        : $VSC_LOCAL_PORT
 SSH tunnel        : ssh $VSC_SSH_OPT -L $VSC_LOCAL_PORT:$VSC_REMOTE_IP:$VSC_REMOTE_PORT -N &
 URL               : http://localhost:$VSC_LOCAL_PORT
+BJOB ID           : $BJOB_ID
 EOF
 
 # setup SSH tunnel from local computer to compute node via login node