Line 25: |
Line 25: |
| safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/test/db.php/template-begin"); | | safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/test/db.php/template-begin"); |
| safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/etc/test/db.php/template-end"); | | safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/etc/test/db.php/template-end"); |
| + | or another utilisation, do a link to an event already existing |
| + | '''existing event''' '''new event linked to the other event''' |
| + | safe_symlink("/etc/e-smith/events/bootstrap-console-save/templates2expand", "root/etc/e-smith/events/service-expand/templates2expand"); |
| + | |
| + | or if you want to do a link to an existing file |
| + | |
| + | '''existing file''' '''link in the rpm''' |
| + | safe_symlink("/usr/share/php/Net/LDAP3","root/usr/share/pear/Net/LDAP3"); |
| + | safe_symlink("/usr/share/php/Net/LDAP3.php","root/usr/share/pear/Net/LDAP3.php"); |
| + | |
| | | |
| * service to restart on demand | | * service to restart on demand |
Line 63: |
Line 73: |
| event_link("phplist-create-pseudo", "$event", "55"); | | event_link("phplist-create-pseudo", "$event", "55"); |
| } | | } |
| + | |
| + | |
| + | * Order of implicit actions |
| + | |
| + | The implicit actions are implemented by inserting the action script generic_template_expand early in the list of actions to be run in an event and the adjust-services action near the end of the list. You should normally link your action scripts in the range S10 to S80 so that they occur after templates2expand and before services2adjust. |
| + | |
| + | {{Note box|The generic_template_expand action is currently run at S05 and services2adjust is run at S90.}} |
| | | |
| ===== service_link_enhanced ===== | | ===== service_link_enhanced ===== |
Line 108: |
Line 125: |
| | | |
| templates2events("/opt/roundcube/config/db.inc.php", console-save); | | templates2events("/opt/roundcube/config/db.inc.php", console-save); |
| + | |
| + | {{Note box|msg=The settings below are new, waiting a release with the bug [[bugzilla: 8951]]}} |
| + | |
| + | ===== event_templates ===== |
| + | This function creates a file tree (of empty files) which is used by the generic_template_expand action to determine which templates need to be expanded for a particular event. Takes one event |
| + | argument and a list of file names, e.g. |
| + | |
| + | event_templates("$event", "/etc/some/file", "/etc/some/file2", "/etc/some/file3", ...); |
| + | |
| + | # templates to expand |
| + | for my $event (qw( |
| + | conf-wordpress |
| + | wordpress-update |
| + | )) |
| + | { |
| + | event_templates ($event , "/etc/httpd/conf/httpd.conf"); |
| + | event_templates ($event , "/etc/dar/DailyBackup.dcf"); |
| + | } |
| + | |
| + | ===== event_actions($event, %actions) ===== |
| + | Create links to actions for the given event. %actions is a list of pairs Action => Priority. E.g |
| + | |
| + | event_actions('myevent', 'action1' => '10', 'action2' => '20', ..); |
| + | |
| + | See also event_link(). |
| + | |
| + | # actions to perform |
| + | for my $event (qw( |
| + | bootstrap-console-save |
| + | console-save |
| + | conf-wordpress |
| + | wordpress-update |
| + | )) |
| + | { |
| + | event_actions ( $event , 'wordpress' => '20', 'wordpressa' => '30' , 'wordpressb' => '40'); |
| + | } |
| + | ===== event_services($event, %services) ===== |
| + | Create links for the given $event in services2adjust/ subdirectory. %services is a list of pairs Service => LinkDestination |
| + | event_services(’myevent’, ’sshd’ => ’restart’, ’samba’ => ’reload’) See also safe_symlink(). |
| + | |
| + | # services to launch on event |
| + | for my $event (qw( |
| + | conf-wordpress |
| + | wordpress-update |
| + | )) |
| + | { |
| + | event_services ( $event , "httpd-e-smith"=> 'sigusr1'); |
| + | event_services ( $event , "mysql.init"=> 'restart'); |
| + | } |
| | | |
| ==== AUTHOR ==== | | ==== AUTHOR ==== |