2 #============================================================= -*-perl-*-
4 # BackupPC_serverMesg: Send one or more commands to the BackupPC server.
7 # As of v1.5.0 the BackupPC server communicates via a unix or internet
8 # domain socket. Every message is protected with an MD5 digest, based
9 # on a shared secret, a sequence number, and a per-connection unique
10 # key. This minimizes the risk of an attacked issuing fake commands
11 # to the BackupPC server.
13 # Previously, telnet could be used to talk to the BackupPC server.
14 # As of v1.5.0 that is no longer possible.
16 # This script replaces telnet as a mechanism for sending BackupPC
19 # BackupPC_serverMesg mesg
22 # BackupPC_serverMesg status info
25 # Craig Barratt <cbarratt@users.sourceforge.net>
28 # Copyright (C) 2001-2003 Craig Barratt
30 # This program is free software; you can redistribute it and/or modify
31 # it under the terms of the GNU General Public License as published by
32 # the Free Software Foundation; either version 2 of the License, or
33 # (at your option) any later version.
35 # This program is distributed in the hope that it will be useful,
36 # but WITHOUT ANY WARRANTY; without even the implied warranty of
37 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 # GNU General Public License for more details.
40 # You should have received a copy of the GNU General Public License
41 # along with this program; if not, write to the Free Software
42 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
44 #========================================================================
46 # Version 2.1.0, released 20 Jun 2004.
48 # See http://backuppc.sourceforge.net.
50 #========================================================================
54 use lib "__INSTALLDIR__/lib";
56 use BackupPC::FileZIO;
62 die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
63 my $TopDir = $bpc->TopDir();
64 my $BinDir = $bpc->BinDir();
65 my %Conf = $bpc->Conf();
70 print("usage: $0 mesg\n");
74 my $err = $bpc->ServerConnect($Conf{ServerHost}, $Conf{ServerPort});
76 print("Can't connect to server ($err)\n");
79 my $reply = $bpc->ServerMesg(join(" ", @ARGV));
80 print("Got reply: $reply");