VERSION: Bump version up to 4.10.12.
[Samba.git] / ctdb / common / event_script.h
blobbf5a8fdf9a218016ac33c58b3e6431c2d2b87db2
1 /*
2 Low level event script handling
4 Copyright (C) Amitay Isaacs 2017
5 Copyright (C) Martin Schwenke 2018
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef __CTDB_SCRIPT_H__
22 #define __CTDB_SCRIPT_H__
24 #include "replace.h"
25 #include "system/filesys.h"
27 #include <talloc.h>
29 /**
30 * @file script.h
32 * @brief Script listing and manipulation
36 struct event_script {
37 char *name;
38 char *path;
39 bool enabled;
42 struct event_script_list {
43 unsigned int num_scripts;
44 struct event_script **script;
48 /**
49 * @brief Retrieve a list of scripts
51 * @param[in] mem_ctx Talloc memory context
52 * @param[in] script_dir Directory containing scripts
53 * @param[out] out List of scripts
54 * @return 0 on success, errno on failure
56 int event_script_get_list(TALLOC_CTX *mem_ctx,
57 const char *script_dir,
58 struct event_script_list **out);
60 /**
61 * @brief Make a script executable or not executable
63 * @param[in] script_dir Directory containing script
64 * @param[in] script_name Name of the script to enable
65 * @param[in] executable True if script should be made executable
66 * @return 0 on success, errno on failure
68 int event_script_chmod(const char *script_dir,
69 const char *script_name,
70 bool executable);
72 #endif /* __CTDB_SCRIPT_H__ */