Deleted Devices
Dan Morphis
dan at milkcarton.com
Mon Feb 4 15:21:38 EST 2019
Use this bash script. It requires you have jq installed.
#!/usr/bin/env bash
SERVER=192.168.7.80
COLLECTION=devices
DATA=`curl http://${SERVER}:7557/${COLLECTION}?projection=_id | jq -r '.[]._id'`
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
*) printf '%%%02X' "'$c" ;;
esac
done
LC_COLLATE=$old_lc_collate
}
#echo $DATA
for id in $DATA; do
i=$( urlencode $id )
echo curl "http://${SERVER}:7557/${COLLECTION}/${i}" -X DELETE
done
On Mon, Feb 4, 2019 at 11:20 AM Alexander Morillo <apps at networkbroadcast.net>
wrote:
> Hi everyone!
>
> I have a question about how I can remove all devices connected to Genieacs. I
> saw an option in Genieacs-gui but it's one by one. Could it be possible
> to delete the database or reset it to zero?
>
> thnks
>
> --
>
> _______________________________________________
> Users mailing list
> Users at lists.genieacs.com
> http://lists.genieacs.com/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genieacs.com/pipermail/users/attachments/20190204/cf347b0d/attachment-0001.html>
More information about the Users
mailing list