You did not read the instructions for the script. The instructions state "If you want to change the script to perform the work instead of echoing the command to the console, delete the echo on line 28"
So you can either delete the echo, or copy and paste those lines into your console. -dan On Mon, Feb 25, 2019 at 11:16 AM Alexander Morillo < [email protected]> wrote: > Hi everyone. > > I was trying to delete all the CPE connected to Genieacs following the > instruction that i read on this forum. I used this script: > > --------------------------------------------------------------------------------------------- > #!/usr/bin/env bash > > SERVER=192.168.20.61 > 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 > > > ------------------------------------------------------------------------------------ > > the console shown me how all the devices was deleted: > > curl > http://192.168.20.61:7557/devices/000018-Hi3798MV200-UPO1877180401776F09CD73E382F > -X DELETE > curl > http://192.168.20.61:7557/devices/000018-Hi3798MV200-UPO1877180401491F09CD73E3712 > -X DELETE > curl > http://192.168.20.61:7557/devices/000018-Hi3798MV200-UPO1877180401803F09CD73E384A > -X DELETE > curl > http://192.168.20.61:7557/devices/000018-Hi3798MV200-UPO1877180401488F09CD73E370F > -X DELETE > curl > http://192.168.20.61:7557/devices/000018-Hi3798MV200-UPO1875180400182F09CD742E3DE > -X DELETE > curl > http://192.168.20.61:7557/devices/000018-Hi3798MV200-UPO1875180400194F09CD742E3EA > -X DELETE > curl > http://192.168.20.61:7557/devices/000018-Hi3798MV200-UPO1875180400195F09CD742E3EB > -X DELETE > curl > http://192.168.20.61:7557/devices/000018-Hi3798MV200-UPO1877180401790F09CD73E383D > -X DELETE > > but on the Gui all of them still appears. Can yu help me with that? > > Thanks > > > -- > > _______________________________________________ > Users mailing list > [email protected] > http://lists.genieacs.com/mailman/listinfo/users >
_______________________________________________ Users mailing list [email protected] http://lists.genieacs.com/mailman/listinfo/users
