Use mktemp for temp dir

main
BDR 2021-03-28 22:20:27 +02:00
parent 5e554c920d
commit 97a37de7c9
1 changed files with 3 additions and 3 deletions

View File

@ -2,10 +2,10 @@
title=tinystatus title=tinystatus
timeout=10 timeout=10
tmp='/tmp/tinystatus' tmp="$(mktemp -d)"
useragent="User-Agent: Mozilla/5.0 (X11; Linux x86_64; Debian) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"
checkfile="${1:-checks.list}" checkfile="${1:-checks.list}"
incidentsfile="${2:-incidents.list}" incidentsfile="${2:-incidents.list}"
useragent="User-Agent: Mozilla/5.0 (X11; Linux x86_64; Debian) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36"
command_exists(){ command_exists(){
if ! command -v "${1}" >/dev/null 2>&1; then if ! command -v "${1}" >/dev/null 2>&1; then
@ -51,7 +51,6 @@ check(){
command_exists 'curl' command_exists 'curl'
command_exists 'nc' command_exists 'nc'
rm -r "${tmp}"
mkdir -p "${tmp}/ok" "${tmp}/ko" || exit 1 mkdir -p "${tmp}/ok" "${tmp}/ko" || exit 1
while IFS='\n' read -r line; do while IFS='\n' read -r line; do
@ -119,4 +118,5 @@ cat <<EOF
</div> </div>
</body></html> </body></html>
EOF EOF
rm -r "${tmp}" 2>/dev/null