I say your shell stuff is worth working on.

I would like to be able to initiate this from a webpage on the Linux server
from a Windows client.

I would also like to be able to browse backed-up files from a webpage on the
Linux host (files are stored on disk - ie not tape) then select a job to
restore back to the windows client.

So if this is worth something to other out there I'll do the webpage
interface, if someone can figure out how to execute the proper console
@commands to restore the files to the windows client, or perhaps there is
another way.  

Rick Meyer

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:bacula-users-
> [EMAIL PROTECTED] On Behalf Of Richard Caley
> Sent: Tuesday, April 12, 2005 8:58 AM
> To: Emery Guevremont
> Cc: bacula-users@lists.sourceforge.net
> Subject: Re: [Bacula-users] Initiating a backup from a windows client
> 
> Here is the script I use to kick of backups of not-always-there
> machines. It's a little hacky, but does the job for me.
> 
> Some assumptions:
> 
>      The client foo is the bacula file demon foo-fd
> 
>      You want to run Differential backups of foo every day it is
>      actually available to be backed up.
> 
>      You have a job which is sheduled never to run automatically which
>      when run by this script will do today's backup. For stupid shell
>      reasons it is important that the job name not contain spaces. In
>      the example below, FooJob.
> 
>      The bacula console config on host bachost is
> 
>        /usr/local/etc/bacula-bachost.conf
> 
> I have been thinking of extending this to be able to run a full backup
> every month or similar, if anyone actually thinks this is interesting
> enough to be worth working on I'll give it a go.
> 
> 
> I run this every hour from root's crontab on the bacula director's
> machine as follows.
> 
>       bacula_backup_if_ready bachost foo-fd 1 FooJob
> 
> Meaning `talk to the bacula console on bachost and if foo has not been
> backed up for at least 1 day, and it is up and available, back it up
> by running FooJob.
> 
> I have only run this on FreeBSD, so there could be minor issues with
> where things are related on other systems.
> 
> --- 8< --- 8< --- CUT HERE for bacula_backup_if_ready --- 8< --- 8< ---
> #!/bin/sh
> 
> if [ $# -lt 3 ]
>       then
>       echo "Use: $0 HOST CLIENT DAYS" JOB1 JOB2...
>       exit 1
> fi
> 
> # set -x
> 
> host=${1-`hostname`}
> 
> host=`expr "$host" : '^\([^.]*\).*'`
> 
> exec > /var/log/bacula_oportunistic-$host 2>&1
> 
> conf=/usr/local/etc/bacula-$host.conf
> 
> client="$2"
> days="$3"
> 
> shift 3
> 
> client_host=`expr "$client" : '\(.*\)-fd'`
> 
> # Shell function which runs a command via the
> # bacula console.
> 
> bacula_command()
> {
> t="$1"
> c="$2"
> 
> shift 2
> 
> { echo "$c"; for a in "$@" ; do echo "$a"; done; } |
> /usr/local/sbin/console -c "$conf"&
> 
> bacula_pid=$!
> 
> (sleep $t; kill $bacula_pid 2>/dev/null >&2)&
> 
> wait $bacula_pid
> }
> 
> # Check timestamp to see if we are due a backup.
> 
> [ -d /var/bacula_timestamps ] || mkdir /var/bacula_timestamps
> 
> timestamp=`find /var/bacula_timestamps -name $client -mtime -$days`
> 
> echo timestamp=$timestamp
> 
> if [ -z "$timestamp" ]
>       then
>       if /sbin/ping -c 1 $client_host && bacula_command 10 "status
> client=$client"
>               then
>               for job in "$@"
>                       do
>                       if bacula_command 10 "run \"$job\"" "mod" "1" "4"
"yes"
>                               then
>                               echo -n > /var/bacula_timestamps/$client
>                       fi
>               done
>       fi
> fi
> 
> 
> --- 8< --- 8< --- bacula_backup_if_ready end --- 8< --- 8< ---
> 
> 
>       ^_^
>      (O O)
>      \_/@@\
>       \\~~/
>         ~~
>               - RJC
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Bacula-users mailing list
> Bacula-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bacula-users






-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to