Page 1 of 2

API Suspened Users

Posted: Sun Sep 27, 2015 3:23 pm
by elicast
someone could tell me how to create a function to block multiple User by api vestacp

Re: API Suspened Users

Posted: Sun Sep 27, 2015 3:39 pm
by tjebbeke
elicast wrote:someone could tell me how to create a function to block multiple User by api vestacp

Create this with name 'v-suspend-mutli-user' and execute: v-suspend-mulit-user user1 user2 user3 ...

Code: Select all

#!/bin/bash
for user in "$@"
do
    echo "Suspend user $user"
    v-suspend-user $user
done

Re: API Suspened Users

Posted: Fri Oct 02, 2015 12:54 am
by elicast
It is giving error

http://prntscr.com/8mqw2x

[root@VestaAdminTestes ~]# sudo /usr/local/vesta/bin/e-bloquear-revenda hdlio934hkds
sudo: unable to execute /usr/local/vesta/bin/e-bloquear-revenda: No such file or directory
[root@VestaAdminTestes ~]#

Re: API Suspened Users

Posted: Fri Oct 02, 2015 6:52 am
by tjebbeke
Run:

Code: Select all

ls -la /usr/local/vesta/bin/ | grep "e-bloquear-revenda"  
Check if the row starts with '-rwxr-xr-x'

If not? Run chmod +x /usr/local/vesta/bin/e-bloquear-revenda

Re: API Suspened Users

Posted: Fri Oct 02, 2015 10:42 am
by elicast
thank you for your cooperation, but see the picture, everything is correct, but does not work

see: http://prntscr.com/8muomt

Re: API Suspened Users

Posted: Fri Oct 02, 2015 10:51 am
by tjebbeke
try:
sudo bash /usr/local/vesta/bin/e-bloquear-revenda

Re: API Suspened Users

Posted: Fri Oct 02, 2015 10:53 am
by elicast
[root@VestaAdminTestes ~]# sudo bash /usr/local/vesta/bin/e-bloquear-revenda
'usr/local/vesta/bin/e-bloquear-revenda: line 3: syntax error near unexpected token `do
'usr/local/vesta/bin/e-bloquear-revenda: line 3: `do

Re: API Suspened Users

Posted: Fri Oct 02, 2015 12:24 pm
by tjebbeke

Code: Select all

sudo bash /usr/local/vesta/bin/e-bloquear-revenda username1 username2 username3

Re: API Suspened Users

Posted: Fri Oct 02, 2015 12:43 pm
by elicast
see img: http://prntscr.com/8mvqyf

can not take User

Re: API Suspened Users

Posted: Fri Oct 02, 2015 1:45 pm
by tjebbeke
I do this and it works:

Code: Select all

[root@server5 ~]# v-list-users
USER         PACKAGE    U_DISK     U_BANDWIDTH  SUSPENDED  DATE
---------    ---------  ---------  ---------    ---------  ---------
admin
aardasp
torelay
[root@server5 ~]# cat test.sh
#!/bin/bash
for user in "$@"
do
    echo "Suspend user $user"
    #v-suspend-user $user #uncomment this line
done
[root@server5 ~]# bash test.sh admin aardasp torelay
Suspend user admin
Suspend user aardasp
Suspend user torelay