Home > Articles > Operating Systems, Server

  • Print
  • + Share This
This chapter is from the book

4.13 Before and After Commands

As Section 4.12 "Configuring the Users and Groups Module" explains, you can specify shell commands to be run before and after any action is taken in the module. Because these commands are called for every addition, modification, or deletion of a user or group, they need some way of telling exactly what action is being performed. They can do this using environment variables that are set before the command is run. The available environment variables are shown in Table 4.3.

If you wanted to send out email when a user is created, for example, you could set the Command to run after making changes option to:

[ "$USERADMIN_ACTION" = "CREATE_USER" ] && echo "Added user $USERADMIN_USER 
graphics/ccc.gif($USERADMIN_REAL)" | mail –s "Added new user" you@yourdomain.com
   
  • + Share This
  • 🔖 Save To Your Account