API Suspened Users
API Suspened Users
someone could tell me how to create a function to block multiple User by api vestacp
-
- Collaborator
- Posts: 783
- Joined: Mon May 11, 2015 8:43 am
- Contact:
- Os: CentOS 6x
- Web: apache + nginx
Re: API Suspened Users
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
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 ~]#
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 ~]#
-
- Collaborator
- Posts: 783
- Joined: Mon May 11, 2015 8:43 am
- Contact:
- Os: CentOS 6x
- Web: apache + nginx
Re: API Suspened Users
Run:
Check if the row starts with '-rwxr-xr-x'
If not? Run chmod +x /usr/local/vesta/bin/e-bloquear-revenda
Code: Select all
ls -la /usr/local/vesta/bin/ | grep "e-bloquear-revenda"
If not? Run chmod +x /usr/local/vesta/bin/e-bloquear-revenda
Re: API Suspened Users
thank you for your cooperation, but see the picture, everything is correct, but does not work
see: http://prntscr.com/8muomt
see: http://prntscr.com/8muomt
-
- Collaborator
- Posts: 783
- Joined: Mon May 11, 2015 8:43 am
- Contact:
- Os: CentOS 6x
- Web: apache + nginx
Re: API Suspened Users
try:
sudo bash /usr/local/vesta/bin/e-bloquear-revenda
sudo bash /usr/local/vesta/bin/e-bloquear-revenda
Re: API Suspened Users
[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
'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
-
- Collaborator
- Posts: 783
- Joined: Mon May 11, 2015 8:43 am
- Contact:
- Os: CentOS 6x
- Web: apache + nginx
Re: API Suspened Users
Code: Select all
sudo bash /usr/local/vesta/bin/e-bloquear-revenda username1 username2 username3
-
- Collaborator
- Posts: 783
- Joined: Mon May 11, 2015 8:43 am
- Contact:
- Os: CentOS 6x
- Web: apache + nginx
Re: API Suspened Users
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