Backup problem
Hey gruppe.
Jeg har lavet nogle scripts som skulle sørge for min backup process. Desværre får jeg nogle fejl fra dette fra min cron:
/bin/sh: root: not found
Hvorfor dette - alle mine scripts fungerer fint når jeg kører dem manuelt - Men hvorfor denne fejl fra cron - det har jeg ikke været ude for før - Men det må jo være noget der mangler - men hvad ??????
Jeg har lavet nogle scripts som skulle sørge for min backup process. Desværre får jeg nogle fejl fra dette fra min cron:
/bin/sh: root: not found
Hvorfor dette - alle mine scripts fungerer fint når jeg kører dem manuelt - Men hvorfor denne fejl fra cron - det har jeg ikke været ude for før - Men det må jo være noget der mangler - men hvad ??????
Kommentarer2
Re: Backup problem
Re: Backup problem
#!/bin/bash
#
# This script is made by Per Jørgensen for backing up my
# Configuration,files and music from the different servers
# etc in my network setup
# Define the different variables
# Machines
ALADIN="172.16.0.1"
ATLANTIS="172.16.10.10"
CORE="172.16.20.10"
# Logfile definations
LOGFILE="/var/log/backup.log"
TMP="/tmp/dumplog"
# Commands used during Backup
RSYNC="rsync -avz -e ssh"
echo "`date +%R:%S `: Starting up the backup process." > $LOGFILE
echo "-------------------------------" >> $LOGFILE
echo "The following variables are used:" >> $LOGFILE
echo "Aladin: $ALADIN" >> $LOGFILE
echo "Core: $CORE" >> $LOGFILE
echo "Atlantis: $ATLANTIS" >> $LOGFILE
echo " " >> $LOGFILE
echo "The logfile: $LOGFILE" >> $LOGFILE
echo " " >> $LOGFILE
echo "This script is made by PBJ 2008" >> $LOGFILE
echo "The script is licensed under GNU" >> $LOGFILE
echo " " >> $LOGFILE
echo "Remember - OpenSource is not nessecary free" >> $LOGFILE
# Starting the Backup (Remember to use SSH-keys)
echo "Backing up the needed configurations at Aladin." >> $LOGFILE
$RSYNC peque@aladin:/home/peque/backup/* /storage/aladin/ >> $LOGFILE
echo "Finished with Aladin Machine" >> $LOGFILE
echo " " >> $LOGFILE
echo " " >> $LOGFILE
echo "Backing up the needed configurations on Atlantis." >> $LOGFILE
$RSYNC pbj@atlantis:/home/pbj/backup/* /storage/atlantis/ >> $LOGFILE
echo "Finished with Atlantis Machine" >> $LOGFILE
echo " " >> $LOGFILE
echo " " >> $LOGFILE
echo "Backing up CORE - MythTV server." >> $LOGFILE
echo "Backing up the Music directory:" >> $LOGFILE
$RSYNC core:/storage/music /storage/core >> $LOGFILE
echo "Backing up the CCcam server configuration:" >> $LOGFILE
scp -rv core:/var/etc/CCcam.cfg /storage/core >> $LOGFILE
echo "Backing up CCam server: /emu " >> $LOGFILE
$RSYNC core:/emu /storage/core >> $LOGFILE
echo "Finished with CORE MythTV server." >> $LOGFILE
echo "Finished with CORE MythTV server." >> $LOGFILE
echo " " >> $LOGFILE
echo " " >> $LOGFILE
echo "Ended backup procedure..." >> $LOGFILE
echo "Sending the mail with the info from the backup process." >> $LOGFILE
echo "`date +%R:%S `: Backup process ended."
echo "Backup Process at Backy:" >> $TMP
cat /var/log/backup.log > $TMP
mail -s 'Daily Backup Backy' admin@pbj-design.dk < $TMP
rm -rf /var/log/backup.log
rm -rf $TMP
# EOF
Men det er flere scripts på flere forskellige maskiner - der fejler med denne fejl.
Det er skrevet ind i crontab med følgende linie:
# m h dom mon dow command
0 2 * * * /scripts/backup.sh
Ved kommandoen crontab -e som root
Men min etc/crontab ser således ud:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
#
Så mere hvad kan dette være