69 lines
1.6 KiB
Bash
69 lines
1.6 KiB
Bash
#! /bin/bash
|
|
|
|
# JConf, a JupyterHub user manager. Manages system users and links them with jupyterhub accounts.
|
|
# Version 0.1 - 24th Nov, 2025
|
|
# MIT Licensed, by The Grammer Society
|
|
|
|
|
|
# required options:
|
|
# setup: must be run after downloaded. Will create a new venv in /opt, installs jupyterhub, lab and notebook. Checks if npm is installed, then installs configurable http server, installs itself to /usr/bin. Installs service file, enables and starts it. Adds root to admins.
|
|
# adduser: creates a system user, asks for password, calls jupyterhub api to create a new user, adds penv to user, su user, penv init and penv creates a default environment. Also copy some instructions in readme file.
|
|
# deluser: deletes jupyterhub user, deletes user home, deletes user profile from system.
|
|
# start: starts the server, systemd call
|
|
# stop: stops the server, systemd call
|
|
|
|
title() {
|
|
echo "JConf: JupyterHub Configuration Manager."
|
|
}
|
|
|
|
usage() {
|
|
echo "Must run as root."
|
|
echo "Usage: jconf <command> <args>"
|
|
echo ""
|
|
echo "User Management Commands:"
|
|
echo " - adduser <name>"
|
|
echo " - deluser <name>"
|
|
echo " - listusers"
|
|
echo ""
|
|
echo "Server Management Commands:"
|
|
echo " - start"
|
|
echo " - stop"
|
|
echo " - install"
|
|
echo " - uninstall"
|
|
}
|
|
|
|
|
|
if [ "$#" -lt 1 ]; then
|
|
title
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
cmd=$1
|
|
case "$cmd" in
|
|
adduser)
|
|
echo
|
|
;;
|
|
deluser)
|
|
echo
|
|
;;
|
|
listusers)
|
|
echo
|
|
;;
|
|
start)
|
|
echo
|
|
;;
|
|
stop)
|
|
echo
|
|
;;
|
|
install)
|
|
echo
|
|
;;
|
|
uninstall)
|
|
echo
|
|
;;
|
|
*)
|
|
echo
|
|
;;
|
|
esac
|