Skip to content
Rüdiger Beck edited this page Jan 11, 2018 · 8 revisions

Hooks

Hooks can be used to run your own scripts after users are added/updated/killed with sophomorix-add/sophomorix-update/sophomorix-kill.

To find out in which directory sophomorix expects your scripts and to run them initially, use sophomorix-hook:

For example:

  • sophomorix-hook --update to see which scripts would be run
  • sophomorix-hook --update --run to run the scripts

sophomorix-hook is what you need to debug your scripts. How they are called where the output is logged, ... It shows what is actually done. Even if this wiki page should be outdated.

For Scripts the following rules apply:

  • The script must be executable
  • The <scriptname> must end with a-zA-Z0-9. Other names are ignored (i.E. Editor backups)
  • If there are multiple scripts in a directory, they are run in ascibetically order. So 002-script is run after 001-script.
  • The scripts are run as the last thing, so that sophomorix can continue without delay.
  • The scripts are run in the background (nor sure yet!!!???). STDOUT and STDERR are both logged in one log file per script (appended)
  • The scripts are NOT run when 0 users are added/updated/killed
  • You must decide if you need a global script or school script:
    • Global scripts are called with no Parameter (they should handle ALL users)
    • School scripts are called with the parameter (they should handle ONLY users of this school)
    • You also need to decide what you script must do, when a user is moved FROM another school TO your school OR moved FROM your school TO another school.
  • Your scripts should be designed to run multiple times without falling on their noses.
  • If you need a user list, you must parse the logfiles to see which user was added/updated/killed
    • The following files might be interesting for you:
      • todo
      • todo
Clone this wiki locally