commit 0f13de7f9ca7b2f2e050778a9393236a09c1132a Author: Ubergeek Date: Mon Nov 4 23:38:05 2019 +0000 Adding first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/gen_tdp b/gen_tdp new file mode 100755 index 0000000..28e5f6f --- /dev/null +++ b/gen_tdp @@ -0,0 +1,40 @@ +#!/bin/bash + +cat << _EOF +{ + "name" : "thunix", + "url" : "https://thunix.net", + "want_users":true, + "admin_email": "root@thunix.net", + "signup_url": "https://www.thunix.net/signup", + "description": "Thunix is a community, centered around access to a public *nix system. Thunix offers shell accounts with complete set of programming tools, and follows a continuous integration-continuous deployment of system configuration.", +_EOF + +echo -ne "\t\"user_count\":" +echo $(for i in $(members tilde); do echo $i; done | sort | uniq | wc -l)"," +echo -e "\t\"generated_at\" : \"$(date)\"," +echo -e "\t\"uptime\" : \"$(uptime | cut -f1 -d,)\"," + +member_count=$(for i in $(members tilde); do echo $i; done | sort | uniq | wc -l) + +echo -e "\t\"users\": [" + +for i in $(for i in $(members tilde); do echo $i; done | sort | uniq); do + let count=$count+1 + echo -e "\t{\n\t\t\"user_name\": \"$i\"," + set mod_time= "$(stat -c '%Y' /home/$i/public_html/index.* 2> /dev/null | head -n1)" + if [ ! "$mod_time" == "" ]; then + echo -e "\t\t\"mtime\" : \"0\"," + else + echo -e "\t\t\"mtime\" : \"$(stat -c '%Y' /home/$i/public_html/index.* 2> /dev/null | head -n1)\"," + fi + echo -e "\t\t\"title\" : \""$(curl -L https://www.thunix.net/~$i -so - |grep -iPo '(?<=)(.*)(?=)')"\"" + if [ $count -eq $(for i in $(members tilde); do echo $i; done | sort | uniq | wc -l) ]; then + echo -e "\t}" + else + echo -e "\t}," + fi +done +echo -e "\t]" +echo "}" +