Compare commits
7 Commits
4901af38b4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| fc15f8fff7 | |||
| 59f1607812 | |||
| 4f00bccbe5 | |||
| f082adf206 | |||
|
|
9381838e4f | ||
|
|
62cdc6a67d | ||
| 146c6fb1b1 |
12
active-users
Executable file
12
active-users
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
$jsonFile = '/opt/html/online.json';
|
||||||
|
|
||||||
|
$activeUsers = shell_exec("ps -eo user=,comm= | awk '$2 ~ /sshd/ {print $1}' | grep -vE 'sshd|root' | sort -u");
|
||||||
|
|
||||||
|
$activeUsersArray = array_filter(explode("\n", $activeUsers));
|
||||||
|
|
||||||
|
$activeUsersJson = json_encode($activeUsersArray, JSON_PRETTY_PRINT);
|
||||||
|
|
||||||
|
file_put_contents($jsonFile, $activeUsersJson);
|
||||||
|
?>
|
||||||
14
add_user.sh
14
add_user.sh
@@ -111,11 +111,6 @@ setup_weechat () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
send_welcome_mail () {
|
send_welcome_mail () {
|
||||||
cp welcome_tmp.txt welcome.txt
|
|
||||||
|
|
||||||
echo "Login: $LOGIN" >> welcome.txt
|
|
||||||
echo "Hasło: $PASS" >> welcome.txt
|
|
||||||
|
|
||||||
sendmail -f v0id1st@tylda.org "$LOGIN@tylda.org" << EOF
|
sendmail -f v0id1st@tylda.org "$LOGIN@tylda.org" << EOF
|
||||||
Subject: Witaj na tylda.org!
|
Subject: Witaj na tylda.org!
|
||||||
From: v0id1st@tylda.org
|
From: v0id1st@tylda.org
|
||||||
@@ -129,18 +124,21 @@ Twoje dane do Nextcloud to (https://cloud.tylda.org) to:
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# critical path
|
||||||
setup_user
|
setup_user
|
||||||
|
setup_nextcloud
|
||||||
|
send_welcome_mail
|
||||||
|
|
||||||
|
# less important stuff
|
||||||
|
# shouldn't impact user obtaining registration email
|
||||||
setup_neomutt
|
setup_neomutt
|
||||||
setup_tmux
|
setup_tmux
|
||||||
setup_gemini
|
setup_gemini
|
||||||
setup_html
|
setup_html
|
||||||
setup_weechat
|
setup_weechat
|
||||||
setup_nextcloud
|
|
||||||
|
|
||||||
chown -R "$LOGIN":"$LOGIN" "/home/$LOGIN/"
|
chown -R "$LOGIN":"$LOGIN" "/home/$LOGIN/"
|
||||||
|
|
||||||
send_welcome_mail
|
|
||||||
|
|
||||||
echo 524288000 > "$USER_CG/memory.max" # 500 MB RAM
|
echo 524288000 > "$USER_CG/memory.max" # 500 MB RAM
|
||||||
echo "50000 100000" > "$USER_CG/cpu.max" # 50 % CPU (quota/period μs)
|
echo "50000 100000" > "$USER_CG/cpu.max" # 50 % CPU (quota/period μs)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user