summaryrefslogtreecommitdiff
path: root/docs-xml/smbdotconf/misc/messagecommand.xml
blob: 91df58ab5d1b9fc38993f6c00027bc1612cdc8b7 (plain)
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
<samba:parameter name="message command"
	         context="G"
			 type="string"
		 advanced="1" developer="1"
		 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
<description>
	<para>This specifies what command to run when the 
	server receives a WinPopup style message.</para>

	<para>This would normally be a command that would 
	deliver the message somehow. How this is to be done is 
	up to your imagination.</para>

	<para>An example is:
<programlisting>
<command moreinfo="none">message command = csh -c 'xedit %s;rm %s' &amp;</command>
</programlisting>
	</para>

	<para>This delivers the message using <command moreinfo="none">xedit</command>, then 
	removes it afterwards. <emphasis>NOTE THAT IT IS VERY IMPORTANT 
	THAT THIS COMMAND RETURN IMMEDIATELY</emphasis>. That's why I 
	have the '&amp;' on the end. If it doesn't return immediately then 
	your PCs may freeze when sending messages (they should recover 
	after 30 seconds, hopefully).</para>

	<para>All messages are delivered as the global guest user. 
	The command takes the standard substitutions, although <parameter moreinfo="none">
	%u</parameter> won't work (<parameter moreinfo="none">%U</parameter> may be better 
	in this case).</para>

	<para>Apart from the standard substitutions, some additional 
	ones apply. In particular:</para>

	<itemizedlist>
		<listitem>
			<para><parameter moreinfo="none">%s</parameter> = the filename containing 
				the message.</para>
		</listitem>
			
		<listitem>
			<para><parameter moreinfo="none">%t</parameter> = the destination that 
				the message was sent to (probably the server name).</para>
		</listitem>

		<listitem>
			<para><parameter moreinfo="none">%f</parameter> = who the message 
				is from.</para>
		</listitem>
	</itemizedlist>

	<para>You could make this command send mail, or whatever else 
	takes your fancy. Please let us know of any really interesting 
	ideas you have.</para>

	<para>
	Here's a way of sending the messages as mail to root:
<programlisting>
<command moreinfo="none">message command = /bin/mail -s 'message from %f on %m' root &lt; %s; rm %s</command>
</programlisting>
	</para>

	<para>If you don't have a message command then the message 
	won't be delivered and Samba will tell the sender there was 
	an error. Unfortunately WfWg totally ignores the error code 
	and carries on regardless, saying that the message was delivered.
	</para>

	<para>
	If you want to silently delete it then try:
<programlisting>
<command moreinfo="none">message command = rm %s</command>
</programlisting>
	</para>
	
</description>
<value type="default"></value>
<value type="example">csh -c 'xedit %s; rm %s' &amp;</value>
</samba:parameter>