Moved "exec_trigger" to threads.c

It's a function which is useful only for the server core,
and requires access to the mainconfig data structure