-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpistopserver.9
99 lines (84 loc) · 4.04 KB
/
pistopserver.9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.\" vim: tw=75
.TH pistopclient 1 "June 30, 2022" "manual"
.SH NAME
.PP
pistopserver - pistop server to provide pistop server events
.PP
pistopclient - pistop client to watch pistop server events
.SH SYNOPSIS
.PP
pistopserver [\f[I]options\f[]]
.PP
pistopclient [\f[I]options\f[]]
.SH DESCRIPTION
\fBpistopserver\fR and \fBpistopclient\fR together provide a way to achieve
synchronized startup and shutdown of multiple clients associated with a
single central server. This association can be arbitrary. See the section
EXAMPLE.
\fBpistopserver\fR needs to be run with fd 0 and 1 connected to some TCP/IP
port. This can be done using \fBtcpserver\fR(1), \fBxinetd\fR(1). It can be
any unused port, but having a port greater than 1024 will allow
\fBpistopserver\fR to be run as non-root user. Similarly \fBpistopclient\fR
needs to be connected to some TCP/IP port, with fd 6 reading from the
network and fd 7 writing to the network. This can be easily done by using
\fBtcpclient\fR(1). \fBpistopclient\fR must be run under root if it has to
start/stop system services. It will look for a script named
\fBpistopstart\fR under \fI$HOME/.pistop\fR directory. If this script is
not found, it will use \fBpistopstart\fR script in
\fI@pistoplibexecdir@\fR. The default \fBpistopstart\fR script starts/stops
autofs and mpd service on startup/shutdown and additionally mounts
NFS/samba shares. \fBpistopstart\fR script expects either \fBstart\fR or
\fBstop\fR arguments. If you have the script/program in \fI$HOME/.pistop\fR
it will get updated with the latest script in \fI@pistoplibexecdir@\fR. To
prevent your script from getting automatically upgraded, create a file
named \fI.pistopstart.noovewrite\fR in \fI$HOME/.pistop\fR directory.
\fBpistopstart\fR scripts executes the following user defined scripts (if
present) during mount and unmount of NFS/samba shares
.EX
1. \fI$HOME/.pistop/pre_mount\fR - before auto-mounting a share
2. \fI$HOME/.pistop/post_mount\fR - after auto-mounting a share
3. \fI$HOME/.pistop/pre_unmount\fR - before unmounting an auto-mounted share
4. \fI$HOME/.pistop/post_unmount\fR - after unmounting an auto-mounted share
.EE
You can have \fBpistopserver\fR and \fBpistopclient\fR to be automatically
started on bootup by creating appropriate configuration in rc, systemd(1)
or as a supervised service under svscan(8). You can use
\fI@pistoplibexecdir@/create_service\fR to create a supervised service for
\fBpistopserver\fR on your central server or a supervised service for
\fBpistopclient\fR on your satellite hosts as shown in the examples below.
.EX
Assuming your central host is 192.168.1.100
Create a supervised service for pistopserver on 192.168.1.100
create_service --servicedir=/service --service_name=fclient \
--user=pi --host=192.168.2.101 --port=5555 --add-service
Create a supervised service for pistopclient on all satellite hosts
create_service --servicedir=/service --service_name=fserver \
--user=pi --host=192.168.1.100 --port=5555 --add-service
.EE
If you have your own custom script in $HOME/.pistop directory and don't
require root privileges to stop/start your services, you can edit
\fI@servicedir@/fclient/variables/USER\fR and restart \fBfclient\fR
supervised service.
.SH EXAMPLE
An example of an association is a host with \fBmpd\fR(1) running providing
it's music database using the simple database plugin and all clients using
the same database using the proxy database plugin. When you shutdown the
host with the music database and you want all connected clients to
shutdown, you can use \fBpistopserver\fR and \fBpistopclient\fR. This is
what you need to do
.EX
1. run pistopserver on the host having the mpd database under tcpserver(1)
$ tcpserver -vDHRo 0 5555 /usr/libexec/pistop/pistopserver
2. run pistopclient on all clients with IP of the above tcpserver host as
\fIipaddr\fR. Run this with root privileges so that it can start/stop
system services
$ sudo tcpclient -vDHR -t 300 \fIipaddr\fR 5555 /usr/libexec/pistop/pistopclient
.EE
.SH SEE ALSO
pistopclient(1),
tcpserver(1),
tcpclient(1),
svscan(8),
supervise(8),
svc(1),
mpd(1)