Introduction
Introduction Statistics Contact Development Disclaimer Help
Add add-user-agent.sh script. - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit cb17345a1b7c3cbcc1bed613c888e86d7da1a16a
parent 0e1bfeca8a4e170caf67d4acec8b2bd074d8dcaf
Author: Annna Robert-Houdin <[email protected]>
Date: Sun, 3 Sep 2023 21:01:31 +0200
Add add-user-agent.sh script.
Diffstat:
A modules/http-user-agent/add-user-a… | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/modules/http-user-agent/add-user-agent.sh b/modules/http-user-agen…
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+if [ $# -lt 1 ];
+then
+ printf "usage: %s user-agent\n" "$(basename "$0")" >&2
+ exit 1
+fi
+
+[ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en "$0" "$0" "$@" || :
+
+useragentfile="/home/annna/bin/modules/http-user-agent/user-agents.txt"
+
+useragent="$1"
+isindb="$(grep "${useragent}" "${useragentfile}")"
+if [ -z "${isindb}" ];
+then
+ printf "%s\n" "${useragent}" >> "${useragentfile}"
+ cat "${useragentfile}" | tail -n 5 > "/tmp/user-agents.tmp"
+ cat "/tmp/user-agents.tmp" > "${useragentfile}"
+ rm "/tmp/user-agents.tmp"
+fi
+
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.