NiLUS
16-10-2005, 12:54
Ho un serverino con la Sarge minimale, apache2+mysql+php4+samba.
Ieri notte mi sono fatto uno scriptino x backupparmi le directory /var/www e /var/lib/mysql:
#!/bin/bash
s_path="/var/backups/"
s_filename="bk"$(date +%d%m%Y)".tar.gz"
s_target=$s_path$s_filename
tar czvfP "$s_target" /var/lib/mysql/ /var/www/ >> /dev/null
echo [$(date +%d)/$(date +%m)/$(date +%Y):$(date +%T)] Backup done: $s_filename >> /var/log/backup.log
Se faccio un ps aux | grep cron
root 1982 0.0 0.6 1756 820 ? Ss 12:04 0:00 /usr/sbin/cron
root 2063 0.0 0.3 1536 456 pts/0 S+ 13:53 0:00 grep cron
Quindi suppongo che cron sia operativo.
Allora gli piazzo lo script sotto /etc/cron.daily/, riavvio /etc/init.d/cron (serviva?)... aspetto l'ora fatidica e non succede nulla. Questo è il contenuto di crontab:
# /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.
# This file also has a username field, 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 run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily
47 6 * * 7 root test -x /usr/sbin/anacron || run-parts --report /etc/cron.weekly
52 6 1 * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.monthly
#
Googlo un po' e provo con crontab -e, scrivo nel file:
10 12 * * * root /etc/cron.daily/backup.sh
Riavvio cron, aspetto le 12:15 e ancora niente... dove sto sbagliando?
*EDIT* Ovvio che lanciandolo a mano backup.sh mi crea il file compresso correttamente. Ovvio anche che gli ho dato il chmod +x al file...
Ieri notte mi sono fatto uno scriptino x backupparmi le directory /var/www e /var/lib/mysql:
#!/bin/bash
s_path="/var/backups/"
s_filename="bk"$(date +%d%m%Y)".tar.gz"
s_target=$s_path$s_filename
tar czvfP "$s_target" /var/lib/mysql/ /var/www/ >> /dev/null
echo [$(date +%d)/$(date +%m)/$(date +%Y):$(date +%T)] Backup done: $s_filename >> /var/log/backup.log
Se faccio un ps aux | grep cron
root 1982 0.0 0.6 1756 820 ? Ss 12:04 0:00 /usr/sbin/cron
root 2063 0.0 0.3 1536 456 pts/0 S+ 13:53 0:00 grep cron
Quindi suppongo che cron sia operativo.
Allora gli piazzo lo script sotto /etc/cron.daily/, riavvio /etc/init.d/cron (serviva?)... aspetto l'ora fatidica e non succede nulla. Questo è il contenuto di crontab:
# /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.
# This file also has a username field, 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 run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily
47 6 * * 7 root test -x /usr/sbin/anacron || run-parts --report /etc/cron.weekly
52 6 1 * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.monthly
#
Googlo un po' e provo con crontab -e, scrivo nel file:
10 12 * * * root /etc/cron.daily/backup.sh
Riavvio cron, aspetto le 12:15 e ancora niente... dove sto sbagliando?
*EDIT* Ovvio che lanciandolo a mano backup.sh mi crea il file compresso correttamente. Ovvio anche che gli ho dato il chmod +x al file...