move move old scripts
This commit is contained in:
1 parent
93b262977b
commit
208fbd96b4
27 files changed
+346
No files matched your search
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#i!/bin/bash
|
||||
DISPLAY=:0 sudo -u "$2" notify-send "$1"
|
||||
echo "$1" > /home/$2/asd
|
||||
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
# Send a notification message to all active graphical user sessions
|
||||
# Usage: sudo ./notify_all_gui_users.sh "Your message here"
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 \"message\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MESSAGE="$1"
|
||||
|
||||
loginctl list-sessions --no-legend | while read -r session uid user seat tty; do
|
||||
# Only graphical sessions
|
||||
if [[ "$seat" == seat* ]]; then
|
||||
BUS="/run/user/$uid/bus"
|
||||
|
||||
if [[ -S "$BUS" ]]; then
|
||||
echo XNotify $user $uid $MESSAGE
|
||||
sudo -u "$user" \
|
||||
DBUS_SESSION_BUS_ADDRESS="unix:path=$BUS" \
|
||||
notify-send "$MESSAGE"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
#echo "TERM: $TERM"
|
||||
if [ "${TERM}" == "" ] || [ "${TERM}" == "dumb" ]; then
|
||||
TERM="xterm-256color"
|
||||
fi
|
||||
function stars {
|
||||
width=$(tput cols)
|
||||
for ((counter = 1; counter < $width; counter++)); do
|
||||
# /usr/bin/printf "o"
|
||||
echo -e "*\c"
|
||||
done
|
||||
}
|
||||
function print_string {
|
||||
width=$(($(tput cols)/2-${#1}/2))
|
||||
for ((counter = 1; counter < $width; counter++)); do
|
||||
printf " "
|
||||
done
|
||||
printf "%s\n" "$1"
|
||||
}
|
||||
HOSTNAME="$HOSTNAME"
|
||||
time=$(date +%H)
|
||||
if [ $time -le 12 ]; then
|
||||
welcomestr="Good Mornig"
|
||||
elif [ $time -gt 12 ] && [ $time -lt 19 ]; then
|
||||
welcomestr="Good Afternoon"
|
||||
elif [ $time -gt 19 ]; then
|
||||
welcomestr="Good Evening"
|
||||
fi
|
||||
stars
|
||||
printf "\n"
|
||||
print_string "Server: $HOSTNAME"
|
||||
stars
|
||||
printf "\n%s %s!\n\n" "$welcomestr" "$(whoami)"
|
||||
printf "%s\n" "$(date +"%A, %d %B %Y, %T")"
|
||||
printf "Uptime: %s\n" "$(uptime)"
|
||||
|
||||
cat /home/lucas/.bash_motd
|
||||
Executable
+153
@@ -0,0 +1,153 @@
|
||||
#!/bin/bash
|
||||
tab() {
|
||||
if [ $# -lt 2 ]; then printf "\t"; fi
|
||||
for ((i_tab=${#2};i_tab<$1;i_tab++)); do printf " "; done
|
||||
}
|
||||
|
||||
if [ "$1" != "-o" ]; then
|
||||
exec 1>/home/lucas/.bash_motd_buff
|
||||
fi
|
||||
if [ "$(/sbin/ip -br link | grep bond0)" != "" ];then
|
||||
if1="bond0"
|
||||
ip1="$(/sbin/ip -br link bond0 | grep -o "10\.0\.0\.103")"
|
||||
|
||||
if2="$(cat /proc/net/bonding/bond0 | grep 'Currently Active Slave:' | grep -o 'wlan0\|eth0')"
|
||||
if [ "if2" == "" ]; then
|
||||
printf "*******************************WTF? No bond IF2?*******************************\n"
|
||||
fi
|
||||
ip2="$(ip addr show $if2 | grep -o '10\.0\.0\.27\|10\.0\.0\.103')"
|
||||
printf "%s:\t%s\t" "$if1" "$ip1"
|
||||
else
|
||||
ifx=( $(ip -br link | cut -f1 -d' ' | grep -v lo) )
|
||||
for i in ${!ifx[@]}; do
|
||||
ipx[$i]="$(ip addr show ${ifx[$i]} | grep -m1 -o -P '(?<=inet ).*(?=/24 brd)')"
|
||||
if [ "${ipx[$i]}" == "" ]; then
|
||||
ipx[$i]="----------"
|
||||
fi
|
||||
done
|
||||
printf "%s:\t%s\t" "${ifx[0]}" "${ipx[0]}"
|
||||
fi
|
||||
ip="$(wget -T 5 -qO- ifconfig.co)"
|
||||
location="$(wget -T 5 -qO- ifconfig.co/country)"
|
||||
city=$(wget -T 5 -qO- ifconfig.co/city)
|
||||
if [ "${ip}" == "" ]; then
|
||||
ip="IP empty"
|
||||
elif [ "${location}" == "" ]; then
|
||||
location="No LOC"
|
||||
elif [ "${city}" == "" ]; then
|
||||
city="No City"
|
||||
fi
|
||||
printf "\tUser: $(whoami)"; tab 14 "$(whoami)"; printf "$ip"; tab 17 "$ip"; printf "$location\n"
|
||||
if [ "$HOSTNAME" == "quiethost" ]; then
|
||||
for ((i=1; i<${#ifx[@]}; i++)); do
|
||||
printf "%s:\t%s" "${ifx[$i]}" "${ipx[$i]}"
|
||||
if [ $i -eq 1 ]; then printf "\t\t\t\t\t\t${city}\n";
|
||||
else printf "\n";
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ "$HOSTNAME" == "raspberry" ]; then
|
||||
printf "%s:\t%s\t\t" "${ifx[1]}" "${ipx[1]}"
|
||||
fi
|
||||
if [ "$HOSTNAME" == "quiethost_dep" ]; then
|
||||
printf "WallpaperChanger: "
|
||||
if [ "$(ps -elf | grep -v grep | grep wallpaperChanger.sh)" = "" ]; then
|
||||
printf "[ OFF ]\t\t"
|
||||
else
|
||||
time="$(ps -elf | grep -v grep | grep wallpaperChanger.sh | sed 's/ \+/ /g' | cut -f18 -d' ')"
|
||||
printf "[ ON ]\t%s min\t" "$time"
|
||||
fi
|
||||
printf "\n"
|
||||
KURS1="$(wget -qO- https://www.fondsprofessionell.at/fonds/details/fondsName/Amundi-Komfort-Invest-traditionell-T/ISIN/AT0000801071/fondsID/FU_80107/)"
|
||||
KURS2="$(wget -qO- https://www.fondsprofessionell.at/fonds/details/ISIN/AT0000A2L443/fondsID/FU_100076607/)"
|
||||
KURS3="$(wget -qO- https://www.fondsprofessionell.at/fonds/details/fondsName/Amundi-CPR-Climate-Action-T/ISIN/AT0000A28YU4/fondsID/FU_100070247/)"
|
||||
DATE1="$(printf "%s\n" "${KURS1}" | sed 's/<\/b>/<\/b>\n/g' | grep -o -P '(?<=<b>NAV am ).*(?= </b>)')"
|
||||
DATE2="$(printf "%s\n" "${KURS2}" | sed 's/<\/b>/<\/b>\n/g' | grep -o -P '(?<=<b>NAV am ).*(?= </b>)')"
|
||||
DATE3="$(printf "%s\n" "${KURS3}" | sed 's/<\/b>/<\/b>\n/g' | grep -o -P '(?<=<b>NAV am ).*(?= </b>)')"
|
||||
KURS_EUR1=$(printf "%s\n" "${KURS1}" | sed 's/<\//\n<\//g' | grep -A2 "NAV am" | grep -o -P '(?<=<td> ).*(?=EUR)' | sed 's/ //g' | sed 's/,/./g')
|
||||
KURS_PER1=$(printf "%s\n" "${KURS1}" | sed 's/<\//\n<\//g' | grep -A3 "Änderung (%)" | grep -o -P '(?<=<td> ).*(?=%\))')
|
||||
printf "Traditionell:\t%s EUR" "${KURS_EUR1}"; tab 8 "${KURS_EUR1}"; printf "%s%%)\t${DATE1}\n" "${KURS_PER1}"
|
||||
KURS_EUR2=$(printf "%s\n" "${KURS2}" | sed 's/<\//\n<\//g' | grep -A2 "NAV am" | grep -o -P '(?<=<td> ).*(?=EUR)' | sed 's/ //g' | sed 's/,/./g')
|
||||
KURS_PER2=$(printf "%s\n" "${KURS2}" | sed 's/<\//\n<\//g' | grep -A3 "Änderung (%)" | grep -o -P '(?<=<td> ).*(?=%\))')
|
||||
printf "Dynamisch:\t%s EUR" "${KURS_EUR2}"; tab 8 "${KURS_EUR2}"; printf "%s%%)\t${DATE2}\n" "${KURS_PER2}"
|
||||
KURS_EUR3=$(printf "%s\n" "${KURS3}" | sed 's/<\//\n<\//g' | grep -A2 "NAV am" | grep -o -P '(?<=<td> ).*(?=EUR)' | sed 's/ //g' | sed 's/,/./g')
|
||||
KURS_PER3=$(printf "%s\n" "${KURS3}" | sed 's/<\//\n<\//g' | grep -A3 "Änderung (%)" | grep -o -P '(?<=<td> ).*(?=%\))')
|
||||
printf "Climate:\t%s EUR" "${KURS_EUR3}"; tab 8 "${KURS_EUR3}"; printf "%s%%)\t${DATE3}\n" "${KURS_PER3}"
|
||||
#bash "/home/lucas/Documents/Dokumente/Projekte/Server/scripts/serverhost/update_BA_Data.sh" "${KURS_EUR1}" "${KURS_EUR2}" "${KURS_EUR3}"
|
||||
fi
|
||||
if [ "$HOSTNAME" == "raspberry_dep" ]; then
|
||||
printf "MoistSens: "
|
||||
if [ "$(pgrep recieveMS)" = "" ]; then
|
||||
printf "[ OFF ]\t"
|
||||
else
|
||||
printf "[ ON ]\t"
|
||||
fi
|
||||
printf "BTServer: "
|
||||
if [ "$(pgrep BTserver)" = "" ]; then
|
||||
printf "[ OFF ]\n"
|
||||
else
|
||||
printf "[ ON ]\n"
|
||||
fi
|
||||
fi
|
||||
if [[ "$HOSTNAME" = "serverhost" ]] || [[ "$HOSTNAME" = "workhost" ]]; then
|
||||
printf "OpenVPN: "
|
||||
if [ "$(pgrep openvpn)" = "" ]; then
|
||||
printf "[ OFF ]\t"
|
||||
else
|
||||
printf "[ ON ] PID: %s" "$(pgrep openvpn | tr '\n' ' ')"
|
||||
fi
|
||||
if [[ "$HOSTNAME" = "serverhost" ]]; then
|
||||
printf "\tUser: deluge-user"; tab 14 "deluge-user";
|
||||
ip=$(sudo /home/lucas/scripts/serverhost/deluge_user_cmd.sh wget -T 2 -qO- ifconfig.co)
|
||||
if [ "$ip" != "" ]; then
|
||||
location=$(sudo /home/lucas/scripts/serverhost/deluge_user_cmd.sh wget -T 2 -qO- ifconfig.co/country)
|
||||
# city=$(sudo /home/lucas/scripts/serverhost/deluge_user_cmd.sh wget -T 2 -qO- ifconfig.co/city)
|
||||
printf "$ip"; tab 17 "$ip"; printf "$location\n"
|
||||
else
|
||||
printf "No Connection\n"
|
||||
fi
|
||||
else
|
||||
printf "\n"
|
||||
fi
|
||||
fi
|
||||
printf "\n"
|
||||
SPACE_TAB=18
|
||||
mem="$(free -h | awk 'NR==2 { printf "Total: %sB,\tUsed: %sB,\tFree: %sB",$2,$3,$7; }')"
|
||||
printf "Memory:"; tab ${SPACE_TAB} "Memory:"; printf "$mem\n";
|
||||
IFS=$'\n'; set -f
|
||||
data_dev=($(df -h | grep "/dev/sd[a-f]" | sed 's/ \+/ /g' | cut -f1 -d' '))
|
||||
unset IFS; set +f
|
||||
osspace=""
|
||||
for ((i=0;i<${#data_dev[@]};i++)); do
|
||||
device="$(df -h "${data_dev[$i]}" | sed 's/ \+/ /g' | tail -1 | cut -f6 -d' ')"
|
||||
if [ "$device" != "/" ]; then
|
||||
device="/$(echo $device | rev | cut -f1 -d'/' |rev):"
|
||||
else
|
||||
device="/root:"
|
||||
fi
|
||||
if [[ "$(echo $device | grep "efi")" != "" ]] || [[ "$(echo $device | grep "win10")" != "" ]]; then continue; fi
|
||||
osspace="$(df -h "${data_dev[$i]}" | awk 'NR==2 { printf "Total: %sB,\tUsed: %sB,\tFree: %sB\t%s used\n",$2,$3,$4,$5; }')"
|
||||
printf "%s" "${device}"
|
||||
tab ${SPACE_TAB} "${device}";
|
||||
printf "%s\n" "$osspace"
|
||||
done
|
||||
tabs -8
|
||||
if [[ "$HOSTNAME" = "raspberry" ]]; then
|
||||
temp="$(/opt/vc/bin/vcgencmd measure_temp | cut -c "6-9") ºC"
|
||||
temp="Temperature...: $temp"
|
||||
echo $temp
|
||||
fi
|
||||
if [[ "$HOSTNAME" = "workhost" ]] || [[ "$HOSTNAME" = "raspberry" ]] && [[ -f /etc/motd ]]; then
|
||||
cat /etc/motd
|
||||
fi
|
||||
if [[ "$HOSTNAME" = "serverhost" ]] || [[ "$HOSTNAME" = "quiethost" ]]; then
|
||||
sudo /etc/update-motd.d/90-updates-available
|
||||
|
||||
if [ -f /etc/motd ]; then cat /etc/motd; fi
|
||||
sudo /etc/update-motd.d/91-release-upgrade
|
||||
sudo /etc/update-motd.d/98-fsck-at-reboot
|
||||
sudo /etc/update-motd.d/98-reboot-required
|
||||
fi
|
||||
if [[ "$1" != "-o" ]] && [[ -f /home/lucas/.bash_motd_buff ]]; then
|
||||
mv /home/lucas/.bash_motd_buff /home/lucas/.bash_motd
|
||||
fi
|
||||
Reference in new issue
Block a user