]> git.sesse.net Git - backup.sh/blobdiff - backup.sh
Spelling fixes.
[backup.sh] / backup.sh
index 985bb1c1865781e8686a4585a5617fe52dc03e17..aceb9f3a928cb951583388ab549475f34eea19e2 100755 (executable)
--- a/backup.sh
+++ b/backup.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # backup.sh
 # 
 # Backup up Unix-like computers
@@ -12,7 +12,7 @@
 # mind when hacking:
 #
 # KISS. And by that I mean really simple. Only regular Unix commands, please
-# (but GNU extensions are used).
+# (but GNU extensions are used and moreutils has to be installed).
 #
 # Because of the way we run this script from cron, informational logging goes
 # to stderr and warnings and errors to stdout. This way, we get mail whenever
@@ -93,8 +93,7 @@ unixcomputers=`cat $confdir/computers.unix \
 # Backup only one computer, from command line?
 if [ $1 ] ; then 
   unixcomputers=$1
-fi;
-
+fi
 
 #selve backupen
 # krever at noen variabler er satt
@@ -148,6 +147,9 @@ backup()
   chmod 600 *tgz                      #only for us
   chmod 644 *sdx *idx 2>/dev/null     #everyone can read
 
+  # Let the remote computer know that we ran a successful backup (for nagios)
+  ssh root@$computer touch $filesystem/.lastbackup
+
  else
   # Something wrong happened.
   rm $TARFILE
@@ -236,7 +238,8 @@ do
   sfilesystem=`echo $filesystem | tr '\/\$' '__'`
 
   # Prepare storage area
-  mkdir -m 755 -p $storagedir/$computer/$sfilesystem/{full,daglig} 2>/dev/null
+  mkdir -m 755 -p $storagedir/$computer/$sfilesystem/full 2>/dev/null
+  mkdir -m 755 -p $storagedir/$computer/$sfilesystem/daglig 2>/dev/null
   echo $filesystem > ${storagedir}/${computer}/.${sfilesystem}.name 
   chmod 644 ${storagedir}/${computer}/.${sfilesystem}.name