remove old serverhost scripts
This commit is contained in:
1 parent
2ec34dd1be
commit
7e7a8c3af5
26 files changed
-691
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
#SSH
|
||||
cat /var/log/auth.log | grep sshd | grep -E "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | grep ": Failed"| cut -f1-3,6,7,11 -d' '
|
||||
|
||||
cat /var/log/auth.log | grep sshd | grep -E "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | grep "Accepted" | cut -f1-3,6,7,11 -d' '
|
||||
|
||||
#NextCloud
|
||||
cat /nextcloud/nextcloud/access.log | grep -v dummy | cut -f1 -d' ' | sort | uniq -c
|
||||
cat /nextcloud/nextcloud/access.log | grep -v dummy | cut -f2 -d'"' | cut -f1 -d' ' | sort | uniq -c
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
backup_cal_blumen="/home/lucas/calender_blumen_$(date -d "today" +"%m%d").ics"
|
||||
export WGETRC="/home/lucas/.wgetrc"
|
||||
wget -q --no-check-certificate -O "$backup_cal_blumen" "https://someoneslinux.ddns.net/remote.php/dav/calendars/lucas/blumen?export"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Download Succesfull"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
/usr/bin/chown -R tv-bitch:tv-bitch /torrent/multimedia/Filme
|
||||
@@ -1,394 +0,0 @@
|
||||
#!/bin/bash
|
||||
exec 2>/dev/null
|
||||
if [ "$TERM" != "xterm-256color" ]; then
|
||||
export TERM="xterm-256color"
|
||||
fi
|
||||
DEL_CONSOLE_CMD="deluge-console connect 127.0.0.1:53032;"
|
||||
cond=""
|
||||
norm="$'\e[0m'"
|
||||
red="$'\e[1;31m'"
|
||||
if [ "$(hostname)" == "serverhost" ]; then
|
||||
duser="sudo /home/lucas/scripts/deluge_user_cmd.sh"
|
||||
elif [ "$(hostname)" == "quiethost" ]; then
|
||||
duser=""
|
||||
fi
|
||||
STARS_HANDY="************************"
|
||||
stars() {
|
||||
width=$(tput cols)
|
||||
counter=1
|
||||
while [ $counter -le $width ]; do
|
||||
printf "*"
|
||||
((counter++))
|
||||
done
|
||||
}
|
||||
out=""
|
||||
SEARCH_MODE=false
|
||||
SLIM_MODE=false
|
||||
STATIC_MODE=false
|
||||
DOWN=""
|
||||
HANDY_MODE=false
|
||||
NAMES_MODE=false
|
||||
RM_MODE=false
|
||||
SLEEP_TIME=1
|
||||
DOWNLOADING="ADCFEGCLG"
|
||||
RMS_MODE=false
|
||||
NORMAL_MODE=true
|
||||
GREP_ARR=()
|
||||
GREPV_ARR=()
|
||||
get_config() {
|
||||
while [[ ${1:0:1} == - ]]; do
|
||||
echo "Param: $1"
|
||||
[[ $1 == -t ]] && {
|
||||
if [ "$2" == "" ] ; then echo "Too few arguments"; usage; exit; fi
|
||||
echo "Search Torrent"
|
||||
SLEEP_TIME="$2"
|
||||
shift 2;
|
||||
continue;
|
||||
};
|
||||
[[ $1 == -s ]] && {
|
||||
if [ "$2" == "" ] ; then echo "Too few arguments"; usage; exit; fi
|
||||
echo "Search Torrent"
|
||||
SEARCH_MODE=true
|
||||
NORMAL_MODE=false
|
||||
SEARCH="$2"
|
||||
shift 2;
|
||||
continue;
|
||||
};
|
||||
[[ $1 == -detail ]] && {
|
||||
if [ "$2" == "" ] ; then echo "Too few arguments"; usage; exit; fi
|
||||
echo "Detail Torrent"
|
||||
DETAIL_MODE=true
|
||||
NORMAL_MODE=false
|
||||
SEARCH="$2"
|
||||
shift 2;
|
||||
while [[ ${1:0:1} == - ]]; do
|
||||
[[ $1 == -g ]] && {
|
||||
shift 1
|
||||
while [[ ${1:0:1} != - ]]; do
|
||||
if [ "$1" == "" ]; then break; fi
|
||||
GREP_ARR+=("$1")
|
||||
shift 1
|
||||
continue
|
||||
done
|
||||
}
|
||||
[[ $1 == -v ]] && {
|
||||
shift 1
|
||||
while [[ ${1:0:1} != - ]]; do
|
||||
if [ "$1" == "" ]; then break; fi
|
||||
GREPV_ARR+=("$1")
|
||||
shift 1
|
||||
continue
|
||||
done
|
||||
}
|
||||
done
|
||||
break
|
||||
};
|
||||
[[ $1 == -slim ]] && {
|
||||
echo "Slim Mode"
|
||||
SLIM_MODE=true
|
||||
NORMAL_MODE=false
|
||||
shift 1;
|
||||
continue;
|
||||
};
|
||||
[[ $1 == -ON ]] && {
|
||||
echo "Show only actual Downloading"
|
||||
DOWNLOADING="Down Speed: 0.0 KiB/s"
|
||||
shift 1;
|
||||
continue;
|
||||
};
|
||||
[[ $1 == -on ]] && {
|
||||
echo "Show only State Downloading"
|
||||
DOWN="Speed"
|
||||
shift 1;
|
||||
continue;
|
||||
};
|
||||
[[ $1 == -rm ]] && {
|
||||
echo "RM Mode"
|
||||
RM_MODE=true
|
||||
NORMAL_MODE=false
|
||||
shift 1;
|
||||
continue;
|
||||
};
|
||||
[[ $1 == -rms ]] && {
|
||||
if [ "$2" == "" ] ; then echo "Too few arguments"; usage; exit; fi
|
||||
RMS_SEARCH="$2"
|
||||
echo "RMS Mode"
|
||||
RMS_MODE=true
|
||||
NORMAL_MODE=false
|
||||
shift 2;
|
||||
continue;
|
||||
};
|
||||
[[ $1 == -static ]] && {
|
||||
echo "Static Mode"
|
||||
STATIC_MODE=true
|
||||
shift 1;
|
||||
continue;
|
||||
};
|
||||
[[ $1 == -names ]] && {
|
||||
echo "Names Mode"
|
||||
NAMES_MODE=true
|
||||
NORMAL_MODE=false
|
||||
shift 1;
|
||||
continue;
|
||||
};
|
||||
[[ $1 == -handy ]] && {
|
||||
echo "Handy Mode"
|
||||
HANDY_MODE=true
|
||||
NORMAL_MODE=false
|
||||
shift 1;
|
||||
continue;
|
||||
};
|
||||
[[ $1 == -help ]] && {
|
||||
usage;
|
||||
exit;
|
||||
};
|
||||
echo "Parameter $1 discarded"
|
||||
exit
|
||||
done
|
||||
}
|
||||
|
||||
usage() {
|
||||
printf "Usage:
|
||||
-names\t\t\tfor display of all names and IDs
|
||||
-slim\t\t\tminimal display of torrents
|
||||
-on\t\t\tShow only State Downloading Torrents
|
||||
-ON\t\t\tShow only actual Downloading Torrents
|
||||
-static\t\t\tfor one time display of all deluge modes
|
||||
-handy\t\t\tfor custom smartphone display
|
||||
-rm\t\t\tremove Torrents
|
||||
-s <search>\t\tSearch for one Torrent (Name or ID)
|
||||
-detail <search>\tDeatiled Depiction of one Torrent
|
||||
-g <param>\tParameters to grep
|
||||
-v <param>\tParameters to grep -v
|
||||
-help\t\t\tdisplay this help\n"
|
||||
}
|
||||
print_string() {
|
||||
width=$(($(tput cols)/2-${#1}/2))
|
||||
counter=1
|
||||
while [ $counter -le $width ]; do
|
||||
printf " "
|
||||
((counter++))
|
||||
done
|
||||
printf "%s\n" "$1"
|
||||
}
|
||||
normal_deluge() {
|
||||
${duser} ${DEL_CONSOLE_CMD} info | tr '\n' ';' | sed 's/\[\([~,#]*\)\];/\[\1\]\n/g' | grep -v "${DOWNLOADING}" | grep "${DOWN}" | tr ';' '\n' | sed 's/Size: /\nSize: /g' | sed 's/ Ratio/\nRatio/g' | sed 's/Up Speed/\nUp Speed/g'| sed 's/ETA:/\nETA:/g'| grep 'Name:\|Progress:\|State:\|Size:\|ETA:' | tr '\n' ' ' | sed 's/State/\nState/g' | sed 's/Progress/\nProgress/g' | sed 's/Name/\nName/g' | sed 's/Size/\nSize/g' | sed 's/Progress: \(.*%\)/\\\e[33mProgress: \1\\\e[0m/g' | sed -e "s/Down Speed:\(.*\/s\)/\\\e[31m Speed: \1\\\e[0m/g"
|
||||
}
|
||||
slim_deluge() {
|
||||
${duser} ${DEL_CONSOLE_CMD} info | tr '\n' ';' | sed 's/\[\([~,#]*\)\];/\[\1\]\n/g' | grep -v "${DOWNLOADING}" | grep "${DOWN}" | tr ';' '\n' | sed 's/Down Speed:/\nDown Speed:/g' | sed 's/Up Speed/\nUp Speed/g' | sed 's/ETA/\nETA/g'| sed 's/\[.*\]//g' | grep 'Progress\|Name\|Down Speed\|ETA'| tr --delete '\n' | sed 's/Name:/\nName:/g' | sed 's/Progress: \(.*%\)/ \\\e[33m\1\\\e[0m/g' | sed -e "s/Down Speed:\(.*\/s\)/\tSpeed: \\\e[31m\1\\\e[0m/g" | sort
|
||||
}
|
||||
search_deluge() {
|
||||
${duser} ${DEL_CONSOLE_CMD} info ${SEARCH}
|
||||
}
|
||||
detail_deluge() {
|
||||
STRING=$(${duser} ${DEL_CONSOLE_CMD} info -v ${SEARCH} | grep "Priority" | sed 's/Progress: \(.*%\)/Progress: \\\e[31m\1\\\e[0m/g' | sed 's/Priority: Normal/Normal\n/g' | sed 's/Priority: High/High\n/g' | sed 's/Priority: Highest/Highest\n/g')
|
||||
STRING=$(${duser} ${DEL_CONSOLE_CMD} info -v ${SEARCH} | grep "Priority" | sed 's/Progress: \(.*%\)/Progress: \\\e[31m\1\\\e[0m/g')
|
||||
for (( i=0; i<${#GREP_ARR[*]};i++ )); do
|
||||
STRING="$(printf "%s" "${STRING}" | grep "${GREP_ARR[$i]}")"
|
||||
done
|
||||
for (( i=0;i<${#GREPV_ARR[*]};i++ )); do
|
||||
STRING="$(printf "%s" "${STRING}" | grep -v "${GREPV_ARR[$i]}")"
|
||||
done
|
||||
printf "%s" "${STRING}"
|
||||
}
|
||||
handy_deluge() {
|
||||
STRING=$(${duser} ${DEL_CONSOLE_CMD} info | tr '\n' ';' | sed 's/\[\([~,#]*\)\];/\[\1\]\n/g' | grep -v "${DOWNLOADING}" | grep "${DOWN}" | tr ';' '\n' | sed 's/Size: /\nSize: /g' | sed 's/ Ratio/\nRatio/g' | sed 's/Up Speed/\nUp Speed/g'| sed 's/ETA:/\nETA:/g'| grep 'Name:\|State:\|Size:\|ETA:' | tr '\n' ' ' | sed 's/State/\nState/g' | sed 's/Progress/\nProgress/g' | sed 's/Name/\nName/g' | sed 's/Size/\nSize/g')
|
||||
if [ "${STRING}" == "" ]; then
|
||||
printf "%s\n" "${STARS_HANDY}"
|
||||
printf "\t\t\t\t\t\t No Torrents in deluged client\n"
|
||||
printf "%s\n" "${STARS_HANDY}"
|
||||
else
|
||||
printf "%s\n" "${STARS_HANDY}"
|
||||
printf "\t\t\t\t\t\tCustom Deluge Client\n"
|
||||
printf "%s\n" "${STARS_HANDY}"
|
||||
printf "%s\n" "${STRING}"
|
||||
fi
|
||||
}
|
||||
deluge_rms() {
|
||||
if [ "$1" != "" ]; then
|
||||
names=($(${duser} ${DEL_CONSOLE_CMD} info | grep -v "State: Downloading\|ID:" | grep -v "Queued" | grep -v "Paused" | grep -B2 "State: " | grep Name | sed 's/ */_/g' | sed 's/Name: //g'))
|
||||
ID=($(${duser} ${DEL_CONSOLE_CMD} info | grep -v "State: Downloading" | grep -v "Queued" | grep -v "Paused" | grep -B2 "State: " | grep 'ID: ' | sed 's/ID: //g'))
|
||||
STATE=($(${duser} ${DEL_CONSOLE_CMD} info | grep -v "State: Downloading" | grep -v "Queued" | grep -v "Paused" | sed 's/Up Speed/\nUp Speed/g' | grep "State: " | sed 's/ *//g' | sed 's/State://g'))
|
||||
else
|
||||
names=($(${duser} ${DEL_CONSOLE_CMD} info | grep -v "State: Downloading\|ID:" | grep -v "Paused" | grep -B2 "State: " | grep Name | sed 's/ */_/g' | sed 's/Name: //g'))
|
||||
ID=($(${duser} ${DEL_CONSOLE_CMD} info | grep -v "State: Downloading" | grep -v "Paused" | grep -B2 "State: " | grep 'ID: ' | sed 's/ID: //g'))
|
||||
STATE=($(${duser} ${DEL_CONSOLE_CMD} info | grep -v "State: Downloading" | grep -v "Paused" | sed 's/Up Speed/\nUp Speed/g' | grep "State: " | sed 's/ *//g' | sed 's/State://g'))
|
||||
fi
|
||||
#${DEL_CONSOLE_CMD} info | grep 'Name: ' | sed 's/ */_/g' | sed 's/Name: //g'))
|
||||
if [ ${#names[@]} -eq 0 ]; then
|
||||
stars
|
||||
print_string "No Finished Torrents in deluged client"
|
||||
stars
|
||||
else
|
||||
printf "Which Torrent shall we eliminate?(Enter leading number)\n"
|
||||
echo ${names[1]}
|
||||
for ((i = 0 ; i < ${#names[@]} ; i ++)); do
|
||||
printf "%s: %s\n" "$i" "${names[$i]}"
|
||||
printf "State: %s\n" "${STATE[$i]}"
|
||||
done
|
||||
read -t 10 -n 4 choice1
|
||||
if [ $choice1 -le ${#names[@]} 2>/dev/null ]; then
|
||||
printf "Remove %s\n" "${names[$choice1]}"
|
||||
printf "Remove Data too?(y/q/*)(q for quit)\n"
|
||||
read -t 10 -n 2 choice2
|
||||
if [ "$choice2" == "y" ]; then
|
||||
RM_DATA="--remove_data"
|
||||
elif [ "$choice2" == "q" ]; then
|
||||
echo "Cancell Removal"
|
||||
return
|
||||
else
|
||||
RM_DATA=""
|
||||
fi
|
||||
${duser} ${DEL_CONSOLE_CMD} rm ${RM_DATA} ${ID[$choice1]}
|
||||
if [ $(${duser} ${DEL_CONSOLE_CMD} info | grep -c "Name: ") -eq $((${#names[@]} - 1)) ]; then
|
||||
printf "\e[32mDeletion Successfull\e[0m\n"
|
||||
fi
|
||||
elif [ "${choice1}" == "ALL" ]; then
|
||||
printf "Remove Data too?(y/*)\n"
|
||||
read -t 10 -n 2 choice2
|
||||
if [ "$choice2" == "y" ]; then
|
||||
RM_DATA="--remove_data"
|
||||
else
|
||||
RM_DATA=""
|
||||
fi
|
||||
for ((i = 0 ; i < ${#names[@]} ; i ++)); do
|
||||
${duser} ${DEL_CONSOLE_CMD} rm ${RM_DATA} ${ID[$i]}
|
||||
done
|
||||
else
|
||||
printf " is no valid choice\n"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
deluge_rm() {
|
||||
names=($(${duser} ${DEL_CONSOLE_CMD} info | grep 'Name: ' | sed 's/ */_/g' | sed 's/Name: //g'))
|
||||
if [ ${#names[@]} -eq 0 ]; then
|
||||
stars
|
||||
print_string "No Torrents in deluged client"
|
||||
stars
|
||||
exit 0;
|
||||
fi
|
||||
ID=($(${duser} ${DEL_CONSOLE_CMD} info | grep 'ID: ' | sed 's/ID: //g'))
|
||||
printf "Which Torrent shall we eliminate?(Enter leading number)\n"
|
||||
for ((i = 0 ; i < ${#names[@]} ; i ++)); do
|
||||
printf "%s: %s\n" "$i" "${names[$i]}"
|
||||
done
|
||||
read -t 20 choice1
|
||||
IFS=$';'; set -f
|
||||
array=(${choice1})
|
||||
unset IFS; set +f
|
||||
for title in ${array[@]}; do
|
||||
if [ ${title} -le ${#names[@]} 2>/dev/null ]; then
|
||||
printf "Remove Torrent %d: %s\n" "${title}" "${names[${title}]}"
|
||||
printf "Remove Data too?(y/q/*)(q for quit)\n"
|
||||
read -t 10 -n 2 choice2
|
||||
if [ "$choice2" == "y" ]; then
|
||||
RM_DATA="--remove_data"
|
||||
elif [ "$choice2" == "q" ]; then
|
||||
echo "Cancel Removal"
|
||||
return
|
||||
else
|
||||
RM_DATA=""
|
||||
fi
|
||||
${duser} ${DEL_CONSOLE_CMD} rm ${RM_DATA} ${ID[$title]}
|
||||
if [ $(${duser} ${DEL_CONSOLE_CMD} info | grep -c "Name: ") -eq $((${#names[@]} - 1)) ]; then
|
||||
printf "\e[32mDeletion Successfull\e[0m\n"
|
||||
fi
|
||||
elif [ "${choice1}" == "ALL" ]; then
|
||||
printf "Remove Data too?(y/*)\n"
|
||||
read -t 10 -n 2 choice2
|
||||
if [ "$choice2" == "y" ]; then
|
||||
RM_DATA="--remove_data"
|
||||
else
|
||||
RM_DATA=""
|
||||
fi
|
||||
for ((i = 0 ; i < ${#names[@]} ; i ++)); do
|
||||
${duser} ${DEL_CONSOLE_CMD} rm ${RM_DATA} ${ID[$i]}
|
||||
done
|
||||
else
|
||||
printf " is no valid choice\n"
|
||||
fi
|
||||
done
|
||||
}
|
||||
get_config "$@"
|
||||
printf "Custom Deluged Torrent Client Starting\n"
|
||||
if ${HANDY_MODE}; then
|
||||
handy_deluge
|
||||
elif ${RM_MODE}; then
|
||||
deluge_rm
|
||||
elif ${RMS_MODE}; then
|
||||
deluge_rms "${RMS_SEARCH}"
|
||||
elif ${NAMES_MODE}; then
|
||||
printf "%s\n" "$(${duser} ${DEL_CONSOLE_CMD} info | grep 'Name:\|ID:')"
|
||||
elif [[ "${SLIM_MODE}" == true ]] || [[ "${NORMAL_MODE}" == true ]] ||[[ "${SEARCH_MODE}" == true ]] ||[[ "${DETAIL_MODE}" == true ]]; then
|
||||
while [ "${cond}" == "" ]; do
|
||||
if [[ "${SLIM_MODE}" == true ]]; then
|
||||
STRING=$(slim_deluge)
|
||||
elif [[ "${NORMAL_MODE}" == true ]]; then
|
||||
STRING=$(normal_deluge)
|
||||
elif [[ "${SEARCH_MODE}" == true ]]; then
|
||||
STRING=$(search_deluge)
|
||||
elif [[ "${DETAIL_MODE}" == true ]]; then
|
||||
STRING=$(detail_deluge)
|
||||
fi
|
||||
${duser} find /home/deluge-user/Downloads/Torrents/ -type f -name *".torrent" | while read line
|
||||
do
|
||||
${duser} mv "$line" "$(echo $line | sed 's/ /_/g')"
|
||||
done
|
||||
${duser} find /home/deluge-user/Downloads/Torrents/ -type f -name *".torrent" -exec ${DEL_CONSOLE_CMD} add "{}" \;
|
||||
${duser} find /home/deluge-user/Downloads/Torrents/ -type f -name *".torrent" -exec rm {} \;
|
||||
read -t 1 cond
|
||||
if [[ ${cond} =~ .*magnet.* ]]; then
|
||||
${duser} ${DEL_CONSOLE_CMD} add "${cond}"
|
||||
cond=""
|
||||
elif [[ ${cond} =~ .*torrent.* ]]; then
|
||||
${duser} ${DEL_CONSOLE_CMD} add "/home/deluge-user/Downloads/Torrents/${cond}"
|
||||
cond=""
|
||||
elif [ "${cond:0:4}" == "-rms" ]; then
|
||||
deluge_rms
|
||||
cond=""
|
||||
elif [ "${cond:0:3}" == "-rm" ]; then
|
||||
deluge_rm
|
||||
cond=""
|
||||
elif [ "${cond:0:5}" == "-slim" ]; then
|
||||
SLIM_MODE=true
|
||||
NORMAL_MODE=false; SEARCH_MODE=false; DETAIL_MODE=false;
|
||||
cond=""
|
||||
elif [ "${cond:0:5}" == "-norm" ]; then
|
||||
NORMAL_MODE=true
|
||||
SLIM_MODE=false; SEARCH_MODE=false; DETAIL_MODE=false;
|
||||
cond=""
|
||||
elif [ "${cond:0:3}" == "-ON" ]; then
|
||||
DOWNLOADING="Down Speed: 0.0 KiB/s"
|
||||
cond=""
|
||||
elif [ "${cond:0:4}" == "-OFF" ]; then
|
||||
DOWNLOADING="ADCFEGCLG"
|
||||
cond=""
|
||||
elif [ "${cond:0:3}" == "-on" ]; then
|
||||
DOWN="Speed"
|
||||
cond=""
|
||||
elif [ "${cond:0:4}" == "-off" ]; then
|
||||
DOWN=""
|
||||
cond=""
|
||||
elif [ "${cond:0:2}" == "-c" ]; then
|
||||
echo ${cond:3:$((${#cond}-3))}
|
||||
sleep 2
|
||||
${duser} ${DEL_CONSOLE_CMD} ${cond:3:$((${#cond}-3))}
|
||||
cond=""
|
||||
fi
|
||||
sleep ${SLEEP_TIME}
|
||||
clear
|
||||
if [ "${STRING}" != "" ]; then
|
||||
stars
|
||||
print_string "Custom Deluge Client"
|
||||
stars
|
||||
echo -e "${STRING}"
|
||||
else
|
||||
stars
|
||||
print_string "No Torrents in deluged client"
|
||||
stars
|
||||
fi
|
||||
if ${STATIC_MODE}; then break; fi
|
||||
done
|
||||
else
|
||||
usage
|
||||
fi
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
sudo -u deluge-user -i -- "$@"
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "no" > /home/lucas/.auto_shutdown
|
||||
if [[ "$(cat /home/lucas/.auto_shutdown)" == "no" ]]; then
|
||||
echo "Auto shutdown DISABLED"
|
||||
notify-send "Auto shutdown DISABLED"
|
||||
fi
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "yes" > /home/lucas/.auto_shutdown
|
||||
if [[ "$(cat /home/lucas/.auto_shutdown)" == "yes" ]]; then
|
||||
echo "Auto shutdown ENABLED"
|
||||
notify-send "Auto shutdown ENABLED"
|
||||
fi
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [[ "$@" == "" ]]; then
|
||||
exit
|
||||
fi
|
||||
sudo -u lucas -i -- "$@" >> /home/lucas/lucas_cmd_log.txt
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
cp doc /media/lucas/Data/Backups/backup_$(date -d "today" +"%m%d")
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/bin/bash
|
||||
cond=true
|
||||
while [ $cond == true ]; do
|
||||
if [ "$(ls /torrent)" == "" ]; then
|
||||
printf "No Torrents Found\n"
|
||||
break
|
||||
fi
|
||||
|
||||
printf "Torrents:\n"
|
||||
ls /torrent/Complete/
|
||||
printf "Remove all these Files?\n"
|
||||
read ans
|
||||
if [ "$ans" == "y" ]; then
|
||||
printf "Torrents Removed\n"
|
||||
cond=false
|
||||
rm -dr /torrent/Complete/*
|
||||
elif [ "$ans" == "n" ]; then
|
||||
printf "Nothing Removed\n"
|
||||
cond=false
|
||||
elif [ "$ans" == "s" ]; then
|
||||
printf "Remove Single Torrent or Group\n"
|
||||
read group
|
||||
if [ "$(ls /torrent/Complete/$group*)" == "" ]; then
|
||||
printf "Nothing Found\n"
|
||||
sleep 1
|
||||
else
|
||||
ls /torrent/Complete/$group*
|
||||
printf "Remove?\n"
|
||||
read ans
|
||||
if [ "$ans" == "y" ]; then
|
||||
rm -dr /torrent/complete/$group*
|
||||
cond=false
|
||||
printf "Torrents Removed\n"
|
||||
elif [ "$ans" == "n" ]; then
|
||||
printf "Nothing Removed\n"
|
||||
cond=false
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/bin/bash
|
||||
PW=$(cat /home/lucas/.PW)
|
||||
FOLDER=/torrent/Camera
|
||||
SERVER="https://someoneslinux.ddns.net"
|
||||
nextcloudcmd --trust --user lucas --password ${PW} --path Media/Pictures/Camera ${FOLDER} ${SERVER} 1>/dev/null 2>&1
|
||||
|
||||
find ${FOLDER}/* -type f | xargs -0 -n 1 echo | while read IMG_ORIG
|
||||
do
|
||||
if [[ -d "${IMG_ORIG}" ]] | [[ ! -f "${IMG_ORIG}" ]]; then
|
||||
echo "Item no File, (${IMG_ORIG})"
|
||||
continue
|
||||
fi
|
||||
IMG=${IMG_ORIG}
|
||||
IMG_PATH=${IMG%/*}
|
||||
IMG_FILE=${IMG##*/}
|
||||
PREFIX=${IMG_FILE:0:4}
|
||||
|
||||
if [[ "${PREFIX}" != "IMG_" ]] || [[ "${PREFIX}" != "VID_" ]]; then
|
||||
if [ "$(echo ${IMG} | grep "mp4")" == "" ]; then
|
||||
PREFIX="IMG_"
|
||||
else
|
||||
PREFIX="VID_"
|
||||
fi
|
||||
fi
|
||||
if [[ "${IMG_FILE:0:4}" == "PANO" ]]; then
|
||||
echo Pano
|
||||
IMG="$(echo ${IMG} | sed 's/-//g')"
|
||||
fi
|
||||
if [[ "$(echo ${IMG##*/} | grep "-")" != "" ]];then
|
||||
IMG="$(echo ${IMG} | sed 's/-/_/g')"
|
||||
fi
|
||||
NUM="$(echo ${IMG%.*} | grep -o -E "[0-9]+_[0-9]+")"
|
||||
if [[ $(echo ${NUM} | wc -c) -gt 16 ]]; then
|
||||
echo "Remove long num ${NUM}"
|
||||
if [ "$(echo ${IMG} | grep "mp4")" == "" ]; then
|
||||
PREFIX="IMG_"
|
||||
else
|
||||
PREFIX="VID_"
|
||||
fi
|
||||
NUM="${NUM:0:15}"
|
||||
fi
|
||||
if [[ "${IMG}" == *"_RX0"* ]]; then
|
||||
echo "Randomized Img"
|
||||
NUM="$(echo ${IMG%.*} | grep -o -E "[0-9]+_[0-9]+_RX0[0-9]+")"
|
||||
fi
|
||||
IMG_NEW=${IMG_PATH}/${PREFIX}${NUM}.${IMG##*.}
|
||||
if [[ "${IMG_ORIG}" != "${IMG_NEW}" ]];then
|
||||
if [[ -f "${IMG_NEW}" ]]; then
|
||||
echo "Add Random"
|
||||
IMG_NEW=${IMG_PATH}/${PREFIX}${NUM}_RX0${RANDOM}.${IMG##*.}
|
||||
fi
|
||||
mv "${IMG_ORIG}" "${IMG_NEW}"
|
||||
echo "Rename ${IMG_ORIG} to ${IMG_NEW}"
|
||||
# else
|
||||
# echo "Equal Name ${IMG_NEW}"
|
||||
fi
|
||||
done
|
||||
nextcloudcmd --trust --user lucas --password ${PW} --path Media/Pictures/Camera ${FOLDER} ${SERVER} 1>/dev/null 2>&1
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
syncNC -o -ab -m
|
||||
SOURCE1="/nextcloud/nextcloud-data/lucas/files/Media/Audiobooks/Englisch/"
|
||||
DEST1="/nextcloud/audiobooks-englisch/"
|
||||
SOURCE2="/nextcloud/nextcloud-data/lucas/files/Media/Music/Musik/"
|
||||
DEST2="/nextcloud/navidrome/music/"
|
||||
SOURCE3="/nextcloud/nextcloud-data/lucas/files/Media/Music/Playlists/Nextcloud/"
|
||||
DEST3="/nextcloud/navidrome/music/playlists/Nextcloud/"
|
||||
SOURCE4="/nextcloud/nextcloud-data/lucas/files/Media/Audiobooks/Deutsch/"
|
||||
DEST4="/nextcloud/audiobooks-deutsch/"
|
||||
SOURCE5="/nextcloud/nextcloud-data/lucas/files/Media/Audiobooks/Kinderbücher/"
|
||||
DEST5="/nextcloud/audiobooks-kinder/"
|
||||
echo "Syncing audiobooks..."
|
||||
rsync -avh --delete --chown=lucas:lucas "$SOURCE1" "$DEST1"
|
||||
rsync -avh --delete --chown=lucas:lucas "$SOURCE2" "$DEST2" --exclude="playlists"
|
||||
rsync -avh --delete --chown=lucas:lucas "$SOURCE3" "$DEST3" --mkpath
|
||||
rsync -avh --delete --chown=lucas:lucas "$SOURCE4" "$DEST4"
|
||||
rsync -avh --delete --chown=lucas:lucas "$SOURCE5" "$DEST5"
|
||||
|
||||
echo "Done."
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
TORRENT_PATH="$1"
|
||||
|
||||
echo "$@" >> /home/lucas/.LOG/log_torrentlog.txt
|
||||
|
||||
/home/lucas/mqqt_venv/bin/python /home/lucas/scripts/serverhost/torrent_mqtt.py "$*"
|
||||
|
||||
cp $TORRENT_PATH /torrent/complete/
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
NC_PATH="/home/lucas/Documents/Dokumente/Projekte/Server"
|
||||
printf "\e[34mSync Nextcloud\e[0m\n"
|
||||
syncNC > /dev/null 2>&1
|
||||
printf "\n\e[34mquiethost\e[0m\n"
|
||||
ssh quiethost "crontab -l > /home/lucas/Documents/Dokumente/Projekte/Server/crontab.quiethost.lucas"
|
||||
scp lucas@quiethost:/etc/sudoers.d/nopasswdcmds $NC_PATH/nopasswdcmds.quiethost
|
||||
scp lucas@quiethost:/etc/systemd/system/vpn.service $NC_PATH/vpn.service.quiethost
|
||||
scp lucas@quiethost:/etc/systemd/system/WallpaperChanger.service $NC_PATH/quiethost/WallpaperChanger.service.quiethost
|
||||
scp lucas@quiethost:.config/Nextcloud/nextcloud.cfg $NC_PATH/quiethost/Nextcloud/
|
||||
scp lucas@quiethost:.config/Nextcloud/sync-exclude.lst $NC_PATH/quiethost/Nextcloud/
|
||||
scp lucas@quiethost:.local/share/applications/*.desktop $NC_PATH/quiethost/
|
||||
scp lucas@quiethost:.config/autostart/*.desktop $NC_PATH/quiethost/autostart/
|
||||
if [ "$1" == "-win" ]; then
|
||||
ssh quiethost pkill firefox
|
||||
scp lucas@quiethost:/win10/Users/lucas/AppData/Roaming/Mozilla/Firefox/Profiles/*.default/places.sqlite $NC_PATH/quiethost/
|
||||
scp $NC_PATH/quiethost/places.sqlite lucas@quiethost:.mozilla/firefox/*.default-release/places.sqlite
|
||||
else
|
||||
scp lucas@quiethost:.mozilla/firefox/*.default-release/places.sqlite $NC_PATH/quiethost/
|
||||
scp $NC_PATH/quiethost/places.sqlite lucas@quiethost:/win10/Users/lucas/AppData/Roaming/Mozilla/Firefox/Profiles/*.default/
|
||||
fi
|
||||
scp lucas@quiethost:.unison/*.prf $NC_PATH/quiethost/Unison/
|
||||
ssh quiethost cp /home/lucas/.config/quodlibet/playlists/* /data/DatenLucas/Music/Playlists/
|
||||
printf "\e[34mServerhost\e[0m\n"
|
||||
cp /etc/sudoers.d/nopasswdcmds $NC_PATH/nopasswdcmds.serverhost
|
||||
#cp /etc/rc.local $NC_PATH/rc.local.serverhost
|
||||
printf "\e[34mRaspberry\e[0m\n"
|
||||
rsync -rthvue "ssh -p 1160" --delete-delay --progress lucas@raspberry:/home/lucas/Raspberry/ $NC_PATH/Raspberry/
|
||||
scp lucas@raspberry:/etc/sudoers.d/nopasswdcmds $NC_PATH/nopasswdcmds.raspberry
|
||||
scp lucas@raspberry:/etc/rc.local $NC_PATH/rc.local.raspberry
|
||||
printf "\e[34mRaspberry CRON\e[0m\n"
|
||||
/usr/bin/expect /home/lucas/Documents/Dokumente/Projekte/Server/scripts/cron.sh
|
||||
printf "\e[34mSync Nextcloud\e[0m\n"
|
||||
syncNC > /dev/null 2>&1
|
||||
printf "\e[34mScriptcopy Finished!\e[0m\n"
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
echo "Check for Serverhost state"
|
||||
SHUTDOWN=true
|
||||
if [ $(cat /home/lucas/.auto_shutdown | grep yes | wc -l) -lt 1 ] ; then
|
||||
echo "Auto Shutdown disabled"
|
||||
SHUTDOWN=false
|
||||
fi
|
||||
if [ $(ps -elf | grep -e 'backup_all\.sh' | grep -v grep | wc -l) -ge 1 ]; then
|
||||
echo "Backup in progress"
|
||||
SHUTDOWN=false
|
||||
fi
|
||||
if [ $(ps -elf | grep -e 'upgrade\.sh' | grep -v grep | wc -l) -ge 1 ]; then
|
||||
echo "Upgrade in progress"
|
||||
SHUTDOWN=false
|
||||
fi
|
||||
if $SHUTDOWN; then
|
||||
echo "Shutdown serverhost"
|
||||
sudo /sbin/shutdown -P 1 +6
|
||||
ssh -o ConnectTimeout=4 -p 1504 lucas@quiethost 'notify-send "Shutdown SUCCESSFUL for Serverhost"'
|
||||
timeout 2s notify-send "Shutdown SUCESSFULL for Serverhost"
|
||||
else
|
||||
echo "Skip shutdown"
|
||||
ssh -o ConnectTimeout=4 -p 1504 lucas@quiethost 'notify-send "Shutdown FAILED for Serverhost"'
|
||||
timeout 2s notify-send "Shutdown FAILED for Serverhost"
|
||||
fi
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
count=0
|
||||
DISKS=($(lsblk | grep disk | cut -f1 -d' '))
|
||||
for disk in ${DISKS[@]}; do
|
||||
echo "Test disk ${disk}" > /tmp/log_${disk}
|
||||
{ sudo smartctl -H /dev/${disk} >> /tmp/log_${disk}; echo "Result: $?" >> /tmp/log_${disk};}& PID[$count]=$!
|
||||
((count++))
|
||||
done
|
||||
MAIL_BODY=""
|
||||
for (( i=0; i<${#PID[@]};i++)); do
|
||||
wait ${PID[$i]}
|
||||
MAIL_BODY="$(printf "${MAIL_BODY}\n$(cat /tmp/log_${DISKS[$i]})\nsmartctl for disk ${DISKS[$i]} finished")"
|
||||
done
|
||||
echo "${MAIL_BODY}" | mail -s "Automated Servermessage - smartctl" lucas-f@live.at
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash
|
||||
count=0
|
||||
DISKS=($(lsblk | grep disk | cut -f1 -d' '))
|
||||
for disk in ${DISKS[@]}; do
|
||||
echo "Test disk ${disk}" > /tmp/log_${disk}
|
||||
{ sudo smartctl -H /dev/${disk} >> /tmp/log_${disk}; echo "Result: $?" >> /tmp/log_${disk};}& PID1[$count]=$!
|
||||
{ sudo smartctl -t long /dev/${disk} >> /tmp/log_${disk}; echo "Result: $?" >> /tmp/log_${disk};}& PID2[$count]=$!
|
||||
((count++))
|
||||
done
|
||||
MAIL_BODY=""
|
||||
STARS="***************************"
|
||||
for (( i=0; i<${#PID1[@]};i++)); do
|
||||
wait ${PID1[$i]}
|
||||
wait ${PID2[$i]}
|
||||
MAIL_BODY="$(printf "${STARTS}${DISKS[$i]}${STARTS}${MAIL_BODY}\n$(cat /tmp/log_${DISKS[$i]})\nsmartctl for disk ${DISKS[$i]} finished")"
|
||||
done
|
||||
|
||||
echo "${MAIL_BODY}" | mail -s "Automated Servermessage - smartctl long" lucas-f@live.at
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash
|
||||
count=0
|
||||
DISKS=($(lsblk | grep disk | cut -f1 -d' '))
|
||||
for disk in ${DISKS[@]}; do
|
||||
echo "Test disk ${disk}" > /tmp/log_${disk}
|
||||
{ sudo smartctl -a /dev/${disk} >> /tmp/log_${disk}; echo "Result: $?" >> /tmp/log_${disk};}& PID1[$count]=$!
|
||||
((count++))
|
||||
done
|
||||
MAIL_BODY=""
|
||||
for (( i=0; i<${#PID1[@]};i++)); do
|
||||
wait ${PID[$i]}
|
||||
MAIL_BODY="$(printf "%s\n%s\nsmartctl for disk %s finished" "${MAIL_BODY}" "$(cat /tmp/log_${DISKS[$i]})" "${DISKS[$i]}")"
|
||||
done
|
||||
|
||||
echo "${MAIL_BODY}" | mail -s "Automated Servermessage - smartctl long result" lucas-f@live.at
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
date="$(date +"%Y-%m-%d %T")"
|
||||
#echo $date
|
||||
/usr/bin/expect <<EOD
|
||||
log_user 1
|
||||
spawn ssh -p 1160 lucas@raspberry
|
||||
expect "$ "
|
||||
send "sudo date --set='$date'\r"
|
||||
expect "$ "
|
||||
send "exit\r"
|
||||
expect "$ "
|
||||
EOD
|
||||
exit
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
sudo -u tv-bitch -i -- "$@"
|
||||
Reference in new issue
Block a user