1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

67 Commits

Author SHA1 Message Date
Martin Schwenke
6ec2cfc7da 50.samba eventscript should use is_ctdb_managed_service "winbind".
Currently it checks $CTDB_MANAGES_WINBIND directly in several places.
This doesn't work when someone sets $CTDB_MANAGED_SERVICES directly.

This modifies check_ctdb_manages_winbind() so that it return a
condition rather than modifying $CTDB_MANAGES_WINBIND.  This makes
some code more readable.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 538902fbc1e74134a03987b36b3733ad641f8971)
2011-08-11 10:46:20 +10:00
Martin Schwenke
e96e655430 50.samba eventscript should use is_ctdb_managed_service "samba".
Currently it checks $CTDB_MANAGES_SAMBA directly.  This doesn't work
when someone sets $CTDB_MANAGED_SERVICES directly.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d8f0f8948abd340088720718fef7dc858661ba23)
2011-08-11 10:46:20 +10:00
Martin Schwenke
45bcf843ec 50.samba eventscript should stop/start services when they become (un)managed.
When the value of $CTDB_MANAGES_SAMBA or $CTDB_MANAGES_WINBIND (or
corresponding changes are made to $CTDB_MANAGED_VERSIONS), the
associated service should be started or stopped as necessary.

This add calls to ctdb_start_stop_service() to manage
starting/stopping samba and winbind.

An associated cleanup is made to the initial checks that one of
$CTDB_MANAGES_SAMBA or $CTDB_MANAGES_WINBIND is set, replacing them
with calls to is_ctdb_managed_service().

To handle the winbind cases ctdb_start_stop_service() and
is_ctdb_managed_service() are updated to take an optional service name
parameter.

Signed-off-by: Martin Schwenke <martin@meltin.net>

Conflicts:

	config/events.d/50.samba

	Most of this merged elsewhere.  This just removes a check that
	this is the monitor event.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 257a2e350280c0b76ed2fac588cad167381fda52)
2011-08-11 10:46:20 +10:00
Martin Schwenke
b0e7237653 Eventscripts - remove some more absolute paths to commands.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f5b7cb03aaf19fb4b12fc3f0c14d98ee2d7b0798)
2011-08-04 17:14:11 +10:00
Martin Schwenke
75bbc93c0b Eventscripts: remove unnecessary absolute paths from external commands.
For eventscript unit testing it will be necessary to override external
commands to allow stub implementations to be used.  If absolute paths
aren't used then this can be done using either a fake bin/
subdirectory or by using shell functions.

This removes all of the simple cases of absolute paths.

Signed-off-by: Martin Schwenke <martin@meltin.net>

Conflicts:

	config/ctdb.init
	config/events.d/50.samba

        Keep old code but remove absolute paths.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 05851d50b0078de8bf4691442d718825adca6fe8)
2011-08-03 17:19:15 +10:00
Ronnie Sahlberg
d1edf44e4f If samba fails to start for some reason, make this cause the startup event to fail too, so that ctdbd will re-try the startup event later.
Or else this will leave samba not running.

CQ S1023394

(This used to be ctdb commit f90485b08d32cbe56050718a3b28ca0fe1d64e0f)
2011-05-10 09:59:38 +10:00
Ronnie Sahlberg
a453e79050 50.samba : Tell winbind about every time we add/remove and ip from the node
CQ S1021636

(This used to be ctdb commit 87b279027616cffbcedfd534ac0032cd51238dfe)
2011-02-18 11:29:35 +11:00
Ronnie Sahlberg
57e74f6d8a Dont run net serverid wipe in the background
(This used to be ctdb commit 76c515f9f05f4fb5683b5ff65cf136c168fd882f)
2010-12-22 10:31:26 +11:00
Ronnie Sahlberg
97a6eccaf7 50.samba
Net serverid wipe can take a bit of time sometimes so background it.

Only perform auto start/stop of the managed service on the monitor event

(This used to be ctdb commit deba5cbbf7703a1a24ce88a06c73fca056e05521)
2010-12-14 21:19:28 +11:00
Ronnie Sahlberg
c26c6a01cf only run "serverid wipe" if we are actually running samba.
we dont need to run this on systems where we do run winbind but not samba

(This used to be ctdb commit fcb9e8d1e1c78439ea42adb8b05ad84fbca7f724)
2010-12-10 13:42:12 +11:00
Ronnie Sahlberg
8959c8e850 dont try starting samba through the "init" event
(This used to be ctdb commit e314a449606418a4c4eac6eb319bfcdf1c398cd3)
2010-12-03 11:40:38 +11:00
Ronnie Sahlberg
ebcc866ae0 update autostart/stop to work for samba
(This used to be ctdb commit 37ab57e2adaecc3f7996ea20af45a5df0cd8be76)
2010-11-22 20:42:26 +11:00
Martin Schwenke
3ab768e8d4 50.samba eventscript should stop/start services when they become (un)managed.
When the value of $CTDB_MANAGES_SAMBA or $CTDB_MANAGES_WINBIND (or
corresponding changes are made to $CTDB_MANAGED_VERSIONS), the
associated service should be started or stopped as necessary.

This add calls to ctdb_start_stop_service() to manage
starting/stopping samba and winbind.

An associated cleanup is made to the initial checks that one of
$CTDB_MANAGES_SAMBA or $CTDB_MANAGES_WINBIND is set, replacing them
with calls to is_ctdb_managed_service().

To handle the winbind cases ctdb_start_stop_service() and
is_ctdb_managed_service() are updated to take an optional service name
parameter.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d98f175e8420d921a123ae9c0ce00945350b1537)
2010-11-18 12:12:30 +11:00
Ronnie Sahlberg
dc2f87737d Dont store temporary runtime data in $CTDB_BASE/state
since that will usually be /etc/ctdb/state and storing this under /etc is just
wrong.

Add a new variable CTDB_VARDIR that defaults to /var/ctdb and store the data there instead.

(This used to be ctdb commit 516423c25afa9861d9988096efa8a4a2b12b31b1)
2010-09-03 12:43:28 +10:00
Michael Adam
df77489477 events:50.samba: wipe the local part of the serverid db before starting winbind/smnd/nmbd
This is necessary for the new serverid approach.

Michael

(This used to be ctdb commit 8956f32e571093db7f285b83e4dd32960f8afc7c)
2010-03-29 17:05:06 +11:00
Martin Schwenke
b65a44a4ec Revert "Use wbinfo --ping-dc isntead of wbingo -p sicne this is a more reliable way to determine if winbindd is in a useful state."
This reverts commit 7c95e56ba871a4e0cb893a5cb5d821e7ff6e6dd6.

wbinfo --ping-dc is proving too unreliable.

(This used to be ctdb commit b70021856e76df1ba407c83cfc19bf332fbfc869)
2010-01-12 21:02:44 +11:00
Martin Schwenke
96066d8816 Revert "events/50.samba: only use wbinfo --ping-dc if available"
This reverts commit 7b73834ba3ac197cc8a3020c111f9bb2c567e70b.

wbinfo --ping-dc is proving too unreliable.

(This used to be ctdb commit 178f429a7b6d1008d35e857b6ca1df6adb60d255)
2010-01-12 21:02:11 +11:00
Stefan Metzmacher
af170d1a8a events/50.samba: only use wbinfo --ping-dc if available
metze

(This used to be ctdb commit 7b73834ba3ac197cc8a3020c111f9bb2c567e70b)
2009-12-08 07:38:00 +11:00
Ronnie Sahlberg
cdabe16777 Use wbinfo --ping-dc isntead of wbingo -p sicne this is a more reliable way to determine if winbindd is in a useful state.
(This used to be ctdb commit 7c95e56ba871a4e0cb893a5cb5d821e7ff6e6dd6)
2009-12-07 18:27:46 +11:00
Martin Schwenke
db25ca69e5 Eventscript argument cleanups and introduction of ctdb_standard_event_handler.
The functions file no longer causes a side-effect by doing a shift.
It also doesn't set a convenience variable for $1.

All eventscripts now explicitly use "$1" in their case statement, as
does the initscript.  The absence of a shift means that the
takeip/releaseip events now explicitly reference $2-$4 rather than
$1-$3.

New function ctdb_standard_event_handler handles the status and
setstatus events, and exits for either of those events.  It is called
via a default case in each eventscript, replacing an explicit status
case where applicable.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3d55408cbbb3bb71670b80f3dad5639ea0be5b5b)
2009-12-01 17:43:47 +11:00
Martin Schwenke
d595f41f38 More eventscript cleanups. Initial smoke testing seems OK.
Apart from lots of cleanup work, this also fixes a bug where the share
checks didn't used to cope with directory names containing spaces.
The previous commit also loaded the config incorrectly.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 35a60a63a9b5c7d98dde514ae552239506b691c9)
2009-11-20 16:45:36 +11:00
Martin Schwenke
a4a048b5cd Now vaguely tested initscript updates.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f1e350f9edb74cc44b6c5be4c062fd93e98ba8c4)
2009-11-19 16:48:19 +11:00
Martin Schwenke
73cb65bf1a Eventscripts: Untested factorisations and introduction of status event.
This is the first stage of an experimental change to eventscripts.
Ronnie and I did a few hours of factorisation of 40.vsftpd and applied
many of the changes to 41.httpd.  Other eventscripts were also
modified.

At this stage this is completely untested.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 364e70b763f0ccd7714d15723ad3ea4d7e2968a1)
2009-11-13 18:28:25 +11:00
Ronnie Sahlberg
2501638e15 dont verify winbindd is running properly at startup
(This used to be ctdb commit 9e1b99221c8f257129641f6eda2795537b7ce9de)
2009-11-04 07:50:26 +11:00
Ronnie Sahlberg
9e235af3a2 make the error logged when winbindd fails to access the dc during startup more scary and easier to spot in the logs
(This used to be ctdb commit 0c9b0466fd87b3f1e5d53f867c863217802ac43b)
2009-10-29 11:54:24 +11:00
Ronnie Sahlberg
0588b5f9c5 add a check that winbind can actually talk to teh dc during the startup event
and refuse to start up if it can not

(This used to be ctdb commit 4037b6e73a819a8e2463dfe0959b42875e05e106)
2009-10-27 15:45:03 +11:00
Ronnie Sahlberg
029fd6b00f Revert "try to restart statd everytime it fails, not just the first time"
This reverts commit 4f7b39a4871af28df1c4545ec37db179fa47a7da.

(This used to be ctdb commit db7b96304e4725f29b12398b7582e385daed63ed)
2009-09-15 19:33:35 +10:00
Ronnie Sahlberg
59cacded72 try to restart statd everytime it fails, not just the first time
(This used to be ctdb commit 4f7b39a4871af28df1c4545ec37db179fa47a7da)
2009-09-15 13:35:58 +10:00
Michael Adam
d8f9dad26b Rename the CTDB_INIT_STYLE "ubuntu" to "debian" - this is where it comes from.
Micheal

(This used to be ctdb commit b060911683d8ac201806d35a505867fe3ba9519f)
2009-09-09 09:52:13 +02:00
Mathieu Parent
e12faf771c Fix bashisms in samba event script.
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 0310a6b17d6167c46482a07c6cd96bcabda6ffbc)
2009-09-09 09:52:13 +02:00
Ronnie Sahlberg
001c0f0c7e make it possible to have ctdb manage (start/stop/monitor) winbind without having samba
(This used to be ctdb commit 77574b7d7fe11c8e73957a80845481f3b2a64219)
2009-09-04 02:59:24 +10:00
Andrew Tridgell
4f4f03f84a use less intrusive smbstatus call in periodic connections cleanup
(This used to be ctdb commit a152fdc79e3360049aee66c3e628237a91df181f)
2009-05-06 08:20:55 +10:00
Michael Adam
eac9425820 events.d/50.samba: allow CTDB_SERVICE_{SMB,NMB,WINBIND} to be overriden from sysconfig
Michael

(This used to be ctdb commit b1aba6651143ae1c85b24d78b67c760795ff5bff)
2009-03-09 00:20:30 +01:00
root
c72c15c19a make it possible to disable checking all samba shares.
this is a timeconsuming process and might not be feasible to perform if there are very many thousand shares

(This used to be ctdb commit 051ae5f3c13892b860818eac803d348f09845dc6)
2009-02-20 10:58:34 +11:00
Michael Adam
5e76a9bf65 events 50.samba: fix control of nmbd without separate nmb service script.
protect all potentially empty $CTDB_SERVICE_* script names

Michael

(This used to be ctdb commit df0afcbf9a0308fcd6ddcce1ac9366f785576f44)
2009-01-19 21:22:58 +01:00
Michael Adam
4c9db19c9a events 50.samba: also support suse and ubuntu/debain systems
for managing samba and winbind

This uses CTDB_INIT_STYLE as exported by ctdb.init.

suse systems usually have separate init scripts for
smb for smbd and nmb for nmbd, and the ubuntu/debian
start script for smbd and nmbd is called samba instead
of smb (on redhat).

Michael

(This used to be ctdb commit 5fe84f96f3f79baba1f44ba57ce217f501b3c1f8)
2009-01-16 13:33:13 +01:00
Ronnie Sahlberg
d265e62ee7 dont log "running periodic cleanup" ...
(This used to be ctdb commit e25ea88ea4f270ba65ed5fdacd693f1248f343c0)
2008-10-20 09:45:15 +11:00
Andrew Tridgell
71f0641dda run the testparm commands in 50.samba in the background, only running
in the foreground if something fails

(This used to be ctdb commit b1fed105ad780e89a128a611ef0bd659818eeebf)
2008-07-23 15:36:23 +10:00
Ronnie Sahlberg
9a9b506d23 Add two new options
CTDB_SAMBA_SKIP_CONF_CHECK and CTDB_SAMBA_CHECK_PORTS.
The first is used to tell ctdb to no longer monitoring if the smb.conf file is consistent or not.

The second specifies which ports to check that smb is listening on
instead of using testparm to figure this out.

Since the net, testparm and smbstatus may block indefinitely in some configurations
we must have a way to configure ctdb to NOT use any of these three commands
in the scripts. These commands should thus never be used in scripts.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>

(This used to be ctdb commit 2fe52c7979ecd28250ec4ac195d3c3999916e573)
2008-07-15 11:03:35 +10:00
Ronnie Sahlberg
0934f40c2a remove a debugging echo statement
(This used to be ctdb commit 495a6293c284a1e74b9c5e0c112e6ed5feead107)
2008-07-14 11:22:41 +10:00
Ronnie Sahlberg
3c0d725e0b add an option to skip checking that all the samba shares are ok
when monitoring the node health.
this might be useful to skip for environments with thousands of shares

(This used to be ctdb commit dd900d4ed8f07003c4f1db2d441cfc2ef2c89ef5)
2008-07-10 08:56:33 +10:00
Ronnie Sahlberg
46220fc467 read the samba sysconfig from the samba eventscript
(This used to be ctdb commit fb9870916ce0798695b09d33208a19d5de1cfd29)
2008-05-27 08:21:18 +10:00
Andrew Tridgell
e465110f95 Fix the chicken and egg problem with ctdb/samba and a registry smb.conf
This attempts to fix the problem of ctdb event scripts blocking due to
attempted access to the ctdb databases during recovery. The changes are:

  - now only the 'shutdown' and 'startrecovery' events can be called
    with the databases locked in recovery. The event scripts must ensure
    that for these two events no database access is attempted

  - the recovered, takeip and releaseip events could previously be called
    inside a recovery. The code now ensures that this doesn't happen, delaying
    the events till after recovery has finished

  - the 50.samba event script now avoids using testparm unless it is really
    needed

This needs extensive testing.

(This used to be ctdb commit e3cdb8f2be6a44ec877efcd75c7297edb008a80b)
2008-05-14 20:57:04 +10:00
Ronnie Sahlberg
8da0e15a07 from Mathieu PARENT <math.parent@gmail.com>
Simulate "nice service" on systems that do not have "service"

(This used to be ctdb commit d0e6dcbadaf41745d423640e5ff5bafd9f68eb88)
2008-02-13 08:20:20 +11:00
Andrew Tridgell
6b50533c22 fixed egrep pattern to use more compatible expression for spaces
(This used to be ctdb commit 2da3871417bb05da8802093ceeb02e89102d99ad)
2008-01-28 17:27:16 +11:00
Andrew Tridgell
d815bc6f26 the event scripts no longer need to show a date, as its done by the main ctdbd logging function
(This used to be ctdb commit b5e691c4c3fe80b219a9ac355d28b766cb0303f3)
2008-01-16 22:06:44 +11:00
Andrew Tridgell
61fd2d5d6f background the smbstatus -n command
(This used to be ctdb commit 0a05cc6763aa6e57089d3ce70516d359fcddb0e4)
2008-01-07 23:41:07 +11:00
Andrew Tridgell
d38fbaa38b nicer onnode output
(This used to be ctdb commit ac5c1e090d007bc2e3965589731620b87c0217fb)
2008-01-07 14:31:13 +11:00
Andrew Tridgell
74b1678d9d - merge from ronnie
- auto-detect CTDB_MANAGES_WINBIND from smb.conf if not set

(This used to be ctdb commit 3d675c7bcedbd483c923df54d1af068758edc206)
2007-11-18 15:14:54 +11:00
Ronnie Sahlberg
dfa6829621 add CTDB_MANAGES_WINBIND to /etc/sysconfig/ctdb to allow ctdb to be used
in environments where samba is used without winbind

(This used to be ctdb commit 1ae5af14f90fd81a20b14c02c0c5ad355a609134)
2007-11-14 16:17:52 +11:00