before and after command

Webmin
PkStud
2012-09-03
2013-05-22
  • PkStud
    PkStud
    2012-09-03

    if read about before and after command on wiki there was an example that if you want to email the particular user about the user creation place the following command in after command box:

    && echo "Added user $USERADMIN_USER ($USERADMIN_REAL)" | mail -s "Added new user" you@yourdomain.com

    i took this example and modified it so before deleting a user it should first kill all the process under that particular user and for that i made a small bash script (killuser) that would calculate all the pids running under that user and placed the following command under before command box:

    && echo "Deleted process under  $USERADMIN_USER"  | killuser $USERADMIN_USER

    it worked fine under the deletion process of the user but as soon as you create a new user you get this error:

    Failed to save user : Before update command failed

    can anyone help me please