LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 11-24-2009, 02:23 AM   #1
m.mancio
LQ Newbie
 
Registered: Oct 2009
Posts: 11

Rep: Reputation: 0
Cron, Script & ubuntu 9.10


Hi,
I have a problem with a script (an easy tar for backup), if I run it from shell all goes well, if I run it from cron it's create only a tree of directory without any files. I have put it in cron with command:

sudo crontab -e

$ ll -hrt /backup/
...
-rw-r--r-- 1 root root 140M 2009-11-22 09:49 backup_full-22.11.2009-09:48.tgz -> via shell
-rw-r--r-- 1 root root 4.6K 2009-11-22 11:19 backup_full-22.11.2009-11:19.tgz -> via cron


Thanks Mauro
 
Old 11-24-2009, 02:43 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Slackware 13.37, Debian Squeeze
Posts: 7,964
Blog Entries: 25

Rep: Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009
A common cron problem is assuming that the environment set up by cron is similar to the one set up for an interactive shell. It isn't, it is simpler.

You can get around the issue by changing the first line of your script (assuming it is a bash script) to #!/bin/bash -l (that's a letter l for "login") or by explicitly setting-and-exporting $PATH to the value used in testing with export PATH=<whatever>.

Last edited by catkin; 11-24-2009 at 02:55 AM. Reason: bolding
 
Old 11-24-2009, 02:44 AM   #3
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Slackware current
Posts: 8,457

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Since cron uses a limited PATH, make sure to give the whole PATH to all the commands.
 
Old 11-24-2009, 03:28 AM   #4
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: OpenSUSE 12.1 CentOS 6.2
Posts: 8,967

Rep: Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345Reputation: 1345
Doubtfully the tar command is not found by cron, unless the user has manually installed a new release somewhere in the system (for example). Indeed, the cron job did execute the tar command. The problem could be related to correctly specify the absolute path of the files to be archived: take in mind that cron assumes the HOME directory as your current directory, despite the location of the executed script. Actually, another good practice in writing scripts for cron jobs is to use absolute path for both the commands (as suggested by previous posts) and the files.

In any case, it would be easier for us to state where exactly the problem resides if you could post the relevant (or all) the lines of your code.
 
Old 11-24-2009, 10:38 AM   #5
m.mancio
LQ Newbie
 
Registered: Oct 2009
Posts: 11

Original Poster
Rep: Reputation: 0
hello,
tar command it's found, tgz file it's correclty created. Inside this tgz file are only folder but not files inside this folder. This evening I post my code and tree command of detarred archive. Thanks for moment.
 
Old 11-25-2009, 04:25 PM   #6
m.mancio
LQ Newbie
 
Registered: Oct 2009
Posts: 11

Original Poster
Rep: Reputation: 0
hi,
this is my script

Code:
$ sudo cat /scripts/backup.sh   
#!/bin/bash

# TODO Setting smpt

#########################
#       VARIABLES SECTION
#########################

echo "***     Start Backup     ***"
echo "Setting Variables"

# GENERAL PARAMETER
BCK_NAME_HEAD="backup"
BACKUPPED_FOLDER="/home/neo/mail-* \
/var/www/* \
/scripts \
/home/neo/Documenti/Documenti/B&B"
SQL_DUMP=/db_dump
BCK_DIR=/backup
LOG_DIR=/var/log/backup
LOG_BCK_INC=$LOG_DIR/log_backup_incrementale
LOG_BCK_ERR=$LOG_DIR/error
SCRIPT_DIR=/scripts
KEEP_DAYS=15
BCK_TYPE="full"
if [ "$1" = "incr" ]; then
    BCK_TYPE="incr"
fi

# MAIL PARAMETER
TO="xxxxx"
FROM="xxxxx"
SMPT_HOST="localhost"
BODY_ERROR="Sono stati riscontrati degli errori nel backup verificare"
SUB_ERROR="Backup Error"
BODY_CONS="Il backup risulta di 0 Kb"
SUB_CONS="Backup Error"

# DATABASE PARAMETER
DB_PWD="xxxxx"
DB_USER="root"
DB_HOST="localhost"

echo "Variables Set"


#########################
#       PRELIMINAR SECTION
#########################

# CREATE FOLDER FOR BACKUP & LOG

echo "Creating Necessary Backup Folder"
mkdir $BCK_DIR
mkdir $SQL_DUMP
mkdir -p $LOG_BCK_INC
mkdir -p $LOG_BCK_ERR
mkdir $SCRIPT_DIR
touch $LOG_BCK_ERR/log_errori
echo "Directory Created"


#########################
#       SENDEMAIL SECTION
#########################

# CHECK SENDEMAIL SCRIPT

echo "Checking if SendEMAIL Script is present"
if [ ! -x $SCRIPT_DIR/sendEmail-v1.55/sendEmail ]
    then
        echo "SendEMAIL isn't present I'm going to download and install"
        mkdir $SCRIPT_DIR
        cd /$SCRIPT_DIR; wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.55.tar.gz; tar xzvf sendEmail-v1.55.tar.gz; rm -rf #sendEmail-v1.55.tar.gz
        chmod 700 $SCRIPT_DIR/sendEmail-v1.55/sendEmail
    else
        echo "SendEmail is present"
fi


# SET SENDEMAIL VARIABLE

SENDEMAIL=$SCRIPT_DIR/sendEmail-v1.55/sendEmail


#########################
#       BACKUP SECTION
#########################

# CREATE MYSQL DUMP

BCK_SIGNATURE=`date '+%d.%m.%Y-%H:%M'`
echo "Create MySQL Dump"
mysqldump --host=$DB_HOST --user=$DB_USER --password=$DB_PWD --all-databases > $SQL_DUMP/$BCK_NAME_HEAD-$BCK_SIGNATURE.sql 2> $LOG_BCK_ERR/log_errori
echo "MySQL Dump Created"


# DELETE INCREMENTAL BACKUP LOG

BCK_NAME=backup_inc
if [ "$BCK_TYPE" = "full" ]
    then
        BCK_NAME=backup_full
        echo "Remove Backup Incremental Log"
        rm -vrf $LOG_BCK_INC/*
        echo "Backup Incremental Log Removed"
fi


# MAKE BACKUP

echo "Creating Tar"
tar vzcf $BCK_DIR/$BCK_NAME-$BCK_SIGNATURE.tgz --listed-incremental=$LOG_BCK_INC/incrementale.tarlog $BACKUPPED_FOLDER $SQL_DUMP 2>> $LOG_BCK_ERR/log_errori
echo "Tar Created"


#########################
#       CHECK SECTION
#########################

# CLEANING ERROR LOG

echo "Clear ErrorLog"
sed -e "/tar: Removing leading/d" $LOG_BCK_ERR/log_errori > $LOG_BCK_ERR/log_errori1
sed -e "/Directory is new/d" $LOG_BCK_ERR/log_errori1 > $LOG_BCK_ERR/log_errori2
sed -e "/Directory has been renamed/d" $LOG_BCK_ERR/log_errori2 > $LOG_BCK_ERR/errorlog
rm -rf $LOG_BCK_ERR/log_errori*
echo "ErrorLog Cleared"

# CHECK ERROR LOG

echo "Check ErrorLog"
if [ -s $LOG_BCK_ERR/errorlog ]
    then
        # WITH ERROR
        echo "Backup Have Some Error Copy And Send ErrorLog"
        cp $LOG_BCK_ERR/errorlog $LOG_BCK_ERR/errorlog-$BCK_SIGNATURE
        $SENDEMAIL -s "$SMPT_HOST" -f "$FROM" -t "$TO" -u "$SUB_ERROR" -m "$BODY_ERROR"
    else
        # WITHOUT ERROR
        echo "No Backup Error"
fi

# CHECK CONSISTENCY OF BACKUP

echo "Check Consistency"
if [ -s `ls $BCK_DIR/$BCK_NAME-$BCK_SIGNATURE.tgz` ]
    then
        # > 0
        echo "Backup Consistent"
    else
        # = 0
        echo "Backup Isn't Consistent Send ErrorLog"
        $SENDEMAIL -s "$SMPT_HOST" -f "$FROM" -t "$TO" -u "$SUB_CONS" -m "$BODY_CONS"
fi


#########################
# REMOVE BACKUP SECTION
#########################

find $BCK_DIR/* -mtime +$KEEP_DAYS | xargs -- rm -rf -- > $LOG_DIR/removed_old_bck-$BCK_SIGNATURE


#########################
#       LAST SECTION
#########################

# REMOVE REDIRECT & DB_DUMP AND BCK WEB SITE DIRECTORY

echo "Removing db_dump Folder"
rm -rf $SQL_DUMP
echo "Db_dump Folder Removed"

# BACKUP END DATE

echo "***     End Backup     ***"
tree of script created via cron

Code:
sudo tree home/          
home/
`-- neo
    |-- Documenti
    |   `-- Documenti
    |       `-- B&B
    |           |-- Giusy B&B_new_album
    |           |   |-- images
    |           |   `-- thumbnails
    |           |-- ShowBankTransferSlip_files
    |           |-- Site Bck
    |           |   `-- Giusy B&B Bck 19092009
    |           |       |-- camera
    |           |       |-- images
    |           |       |-- reservation
    |           |       |   |-- dati
    |           |       |   |-- doc
    |           |       |   `-- includes
    |           |       |       |-- icone
    |           |       |       |-- interconnect
    |           |       |       |-- lang
    |           |       |       |   |-- en
    |           |       |       |   `-- es
    |           |       |       |-- templates
    |           |       |       |   |-- cal
    |           |       |       |   `-- rat
    |           |       |       `-- themes
    |           |       |           |-- sim
    |           |       |           |   `-- inc
    |           |       |           `-- snj
    |           |       |               `-- inc
    |           |       `-- thumbnails
    |           `-- Varie
    |               |-- New photo B&B
    |               |-- images
    |               `-- immagini
    |-- mail-bb
    |   |-- cur
    |   |-- new
    |   `-- tmp
    `-- mail-mancio

39 directories, 0 files
this is tree of script via shell

Code:
sudo tree home/
home/
`-- neo
    |-- Documenti
    |   `-- Documenti
    |       `-- B&B
    |           |-- Giusy B&B_new_album
    |           |   |-- ImagFlowBlack.swf
    |           |   |-- albuminfo.xml
    |           |   |-- images
    |           |   |   |-- 081.jpg
    |           |   |   |-- 086.jpg
    |           |   |   |-- 089.jpg
    |           |   |   |-- 091.jpg
    |           |   |   |-- 093.jpg
    |           |   |   |-- 100_0608.jpg
    |           |   |   |-- 100_0609.jpg
    |           |   |   |-- 100_0610.jpg
    |           |   |   |-- 100_0612.jpg
    |           |   |   |-- 114.jpg
    |           |   |   |-- Fotografie.zip
    |           |   |   `-- imancio_092.jpg
    |           |   |-- index.html
    |           |   `-- thumbnails
    |           |       |-- 081.jpg
    |           |       |-- 086.jpg
    |           |       |-- 089.jpg
    |           |       |-- 091.jpg
    |           |       |-- 093.jpg
    |           |       |-- 100_0608.jpg
    |           |       |-- 100_0609.jpg
    |           |       |-- 100_0610.jpg
    |           |       |-- 100_0612.jpg
    |           |       |-- 114.jpg
    |           |       `-- imancio_092.jpg
    |           |-- Pubblicazione2.pub
    |           |-- ShowBankTransferSlip.htm
    |           |-- ShowBankTransferSlip_files
    |           |   |-- 1057009386-common_js_compiled.js
    |           |   |-- 2079386706-AdsLater.css
    |           |   |-- 4081246072-billing.css
    |           |   `-- closebox.gif
    |           |-- Site Bck
    |           |   |-- Giusy B&B Bck 19092009
    |           |   |   |-- 2.php
    |           |   |   |-- ImagFlowBlack.swf
    |           |   |   |-- Sql254988_1.sql
    |           |   |   |-- Thumbs.db
    |           |   |   |-- Valli Toscane.jpg
    |           |   |   |-- albuminfo.xml
    |           |   |   |-- bandiere-gener.jpg
    |           |   |   |-- camera
    |           |   |   |   |-- iMancio 005.jpg
    |           |   |   |   |-- iMancio 006.jpg
    |           |   |   |   |-- iMancio 007.jpg
    |           |   |   |   |-- iMancio 008.jpg
    |           |   |   |   `-- iMancio 009.jpg
    |           |   |   |-- camere.html
    |           |   |   |-- eng.jpg
    |           |   |   |-- esp.jpg
    |           |   |   |-- fra.jpg
    |           |   |   |-- gallery.swf
    |           |   |   |-- gallery.xml
    |           |   |   |-- ger.jpg
    |           |   |   |-- images
    |           |   |   |   |-- 081.jpg
    |           |   |   |   |-- 086.jpg
    |           |   |   |   |-- 089.jpg
    |           |   |   |   |-- 091.jpg
    |           |   |   |   |-- 093.jpg
    |           |   |   |   |-- 100_0608.jpg
    |           |   |   |   |-- 100_0609.jpg
    |           |   |   |   |-- 100_0610.jpg
    |           |   |   |   |-- 100_0612.jpg
    |           |   |   |   |-- 114.jpg
    |           |   |   |   |-- bagno.jpg
    |           |   |   |   |-- camera.jpg
    |           |   |   |   |-- cucina.jpg
    |           |   |   |   |-- entrata.jpg
    |           |   |   |   |-- entrata1.jpg
    |           |   |   |   |-- entrata2.jpg
    |           |   |   |   |-- imancio_092.jpg
    |           |   |   |   |-- index.jpg
    |           |   |   |   |-- index1.jpg
    |           |   |   |   |-- salotto.jpg
    |           |   |   |   `-- visuale.jpg
    |           |   |   |-- images.jpeg
    |           |   |   |-- index.html
    |           |   |   |-- ita.jpg
    |           |   |   |-- mappa.htm
    |           |   |   |-- prezzi.htm
    |           |   |   |-- prezzo.htm
    |           |   |   |-- reservation
    |           |   |   |   |-- COPYING
    |           |   |   |   |-- README
    |           |   |   |   |-- aggiorna.php
    |           |   |   |   |-- clienti.php
    |           |   |   |   |-- costi.php
    |           |   |   |   |-- crea_backup.php
    |           |   |   |   |-- crea_modelli.php
    |           |   |   |   |-- creaanno.php
    |           |   |   |   |-- creadb.php
    |           |   |   |   |-- creaprezzi.php
    |           |   |   |   |-- crearegole.php
    |           |   |   |   |-- dati
    |           |   |   |   |   |-- DATI
    |           |   |   |   |   |-- abilita_login
    |           |   |   |   |   |-- availability_calendar_tpl.php
    |           |   |   |   |   |-- availability_tpl.php
    |           |   |   |   |   |-- dati_connessione.php
    |           |   |   |   |   |-- lingua.php
    |           |   |   |   |   |-- mdl_disponibilita.php
    |           |   |   |   |   |-- phpres_backup.php
    |           |   |   |   |   |-- selectappartamenti.php
    |           |   |   |   |   |-- selectperiodi2009.1.php
    |           |   |   |   |   |-- selperiodimenu2009.1.php
    |           |   |   |   |   |-- tema.php
    |           |   |   |   |   |-- ultimo_accesso
    |           |   |   |   |   `-- versione.php
    |           |   |   |   |-- dati_relutenti.php
    |           |   |   |   |-- disponibilita.php
    |           |   |   |   |-- doc
    |           |   |   |   |   |-- CHANGELOG
    |           |   |   |   |   |-- README.english
    |           |   |   |   |   |-- README.espagnol
    |           |   |   |   |   |-- README.italiano
    |           |   |   |   |   |-- README.themes
    |           |   |   |   |   |-- README.translation
    |           |   |   |   |   `-- TODO
    |           |   |   |   |-- gestione_utenti.php
    |           |   |   |   |-- includes
    |           |   |   |   |   |-- contr_backup.php
    |           |   |   |   |   |-- costanti.php
    |           |   |   |   |   |-- dati_form_prenotazione.php
    |           |   |   |   |   |-- foot.php
    |           |   |   |   |   |-- funzioni.php
    |           |   |   |   |   |-- funzioni_anno.php
    |           |   |   |   |   |-- funzioni_appartamenti.php
    |           |   |   |   |   |-- funzioni_backup.php
    |           |   |   |   |   |-- funzioni_clienti.php
    |           |   |   |   |   |-- funzioni_costi_agg.php
    |           |   |   |   |   |-- funzioni_ins_prenota.php
    |           |   |   |   |   |-- funzioni_log.php
    |           |   |   |   |   |-- funzioni_menu.php
    |           |   |   |   |   |-- funzioni_mod_prenota.php
    |           |   |   |   |   |-- funzioni_mysql.php
    |           |   |   |   |   |-- funzioni_postgresql.php
    |           |   |   |   |   |-- funzioni_quadro_disp.php
    |           |   |   |   |   |-- funzioni_relutenti.php
    |           |   |   |   |   |-- funzioni_sqlite.php
    |           |   |   |   |   |-- funzioni_testo.php
    |           |   |   |   |   |-- head.php
    |           |   |   |   |   |-- icone
    |           |   |   |   |   |   |-- fr_sx_checkin.gif
    |           |   |   |   |   |   |-- fr_sx_rossa.gif
    |           |   |   |   |   |   |-- freccia_destra_marg.png
    |           |   |   |   |   |   |-- freccia_giu_marg.png
    |           |   |   |   |   |   `-- freccia_su_marg.png
    |           |   |   |   |   |-- interconnect
    |           |   |   |   |   |-- lang
    |           |   |   |   |   |   |-- en
    |           |   |   |   |   |   |   |-- aggiorna.php
    |           |   |   |   |   |   |   |-- clienti.php
    |           |   |   |   |   |   |   |-- costi.php
    |           |   |   |   |   |   |   |-- crea_backup.php
    |           |   |   |   |   |   |   |-- crea_modelli.php
    |           |   |   |   |   |   |   |-- creadb.php
    |           |   |   |   |   |   |   |-- creaprezzi.php
    |           |   |   |   |   |   |   |-- crearegole.php
    |           |   |   |   |   |   |   |-- disponibilita.php
    |           |   |   |   |   |   |   |-- foot.php
    |           |   |   |   |   |   |   |-- funzioni.php
    |           |   |   |   |   |   |   |-- gestione_utenti.php
    |           |   |   |   |   |   |   |-- giorni_mesi.php
    |           |   |   |   |   |   |   |-- head.php
    |           |   |   |   |   |   |   |-- inizio.php
    |           |   |   |   |   |   |   |-- interconnessioni.php
    |           |   |   |   |   |   |   |-- inventario.php
    |           |   |   |   |   |   |   |-- l_n
    |           |   |   |   |   |   |   |-- lista_citta.php
    |           |   |   |   |   |   |   |-- lista_documentiid.php
    |           |   |   |   |   |   |   |-- lista_nazioni.php
    |           |   |   |   |   |   |   |-- lista_parentele.php
    |           |   |   |   |   |   |   |-- lista_regioni.php
    |           |   |   |   |   |   |   |-- messaggi.php
    |           |   |   |   |   |   |   |-- modifica_app.php
    |           |   |   |   |   |   |   |-- modifica_cliente.php
    |           |   |   |   |   |   |   |-- modifica_contratto.php
    |           |   |   |   |   |   |   |-- modifica_costi.php
    |           |   |   |   |   |   |   |-- modifica_ospiti.php
    |           |   |   |   |   |   |   |-- modifica_prenota.php
    |           |   |   |   |   |   |   |-- modifica_var_contr.php
    |           |   |   |   |   |   |   |-- ordine_frasi.php
    |           |   |   |   |   |   |   |-- personalizza.php
    |           |   |   |   |   |   |   |-- prenota.php
    |           |   |   |   |   |   |   |-- privilegi_utenti.php
    |           |   |   |   |   |   |   |-- storia_soldi.php
    |           |   |   |   |   |   |   |-- tab_tariffe.php
    |           |   |   |   |   |   |   |-- tabella.php
    |           |   |   |   |   |   |   |-- tabella2.php
    |           |   |   |   |   |   |   |-- tabella3.php
    |           |   |   |   |   |   |   |-- visualizza_contratto.php
    |           |   |   |   |   |   |   |-- visualizza_contratto_var.php
    |           |   |   |   |   |   |   `-- visualizza_tabelle.php
    |           |   |   |   |   |   `-- es
    |           |   |   |   |   |       |-- aggiorna.php
    |           |   |   |   |   |       |-- clienti.php
    |           |   |   |   |   |       |-- costi.php
    |           |   |   |   |   |       |-- crea_backup.php
    |           |   |   |   |   |       |-- crea_modelli.php
    |           |   |   |   |   |       |-- creadb.php
    |           |   |   |   |   |       |-- creaprezzi.php
    |           |   |   |   |   |       |-- crearegole.php
    |           |   |   |   |   |       |-- disponibilita.php
    |           |   |   |   |   |       |-- foot.php
    |           |   |   |   |   |       |-- funzioni.php
    |           |   |   |   |   |       |-- gestione_utenti.php
    |           |   |   |   |   |       |-- giorni_mesi.php
    |           |   |   |   |   |       |-- head.php
    |           |   |   |   |   |       |-- inizio.php
    |           |   |   |   |   |       |-- interconnessioni.php
    |           |   |   |   |   |       |-- inventario.php
    |           |   |   |   |   |       |-- l_n
    |           |   |   |   |   |       |-- lista_citta.php
    |           |   |   |   |   |       |-- lista_documentiid.php
    |           |   |   |   |   |       |-- lista_nazioni.php
    |           |   |   |   |   |       |-- lista_parentele.php
    |           |   |   |   |   |       |-- lista_regioni.php
    |           |   |   |   |   |       |-- messaggi.php
    |           |   |   |   |   |       |-- modifica_app.php
    |           |   |   |   |   |       |-- modifica_cliente.php
    |           |   |   |   |   |       |-- modifica_contratto.php
    |           |   |   |   |   |       |-- modifica_costi.php
    |           |   |   |   |   |       |-- modifica_ospiti.php
    |           |   |   |   |   |       |-- modifica_prenota.php
    |           |   |   |   |   |       |-- modifica_var_contr.php
    |           |   |   |   |   |       |-- ordine_frasi.php
    |           |   |   |   |   |       |-- personalizza.php
    |           |   |   |   |   |       |-- prenota.php
    |           |   |   |   |   |       |-- privilegi_utenti.php
    |           |   |   |   |   |       |-- storia_soldi.php
    |           |   |   |   |   |       |-- tab_tariffe.php
    |           |   |   |   |   |       |-- tabella.php
    |           |   |   |   |   |       |-- tabella2.php
    |           |   |   |   |   |       |-- tabella3.php
    |           |   |   |   |   |       |-- visualizza_contratto.php
    |           |   |   |   |   |       |-- visualizza_contratto_var.php
    |           |   |   |   |   |       `-- visualizza_tabelle.php
    |           |   |   |   |   |-- liberasettimane.php
    |           |   |   |   |   |-- lista_citta.php
    |           |   |   |   |   |-- lista_documentiid.php
    |           |   |   |   |   |-- lista_nazioni.php
    |           |   |   |   |   |-- lista_parentele.php
    |           |   |   |   |   |-- lista_regioni.php
    |           |   |   |   |   |-- sett_gio.php
    |           |   |   |   |   |-- spezzaprenota.php
    |           |   |   |   |   |-- templates
    |           |   |   |   |   |   |-- cal
    |           |   |   |   |   |   |   |-- form.php
    |           |   |   |   |   |   |   |-- functions.php
    |           |   |   |   |   |   |   |-- name.php
    |           |   |   |   |   |   |   |-- phrases.php
    |           |   |   |   |   |   |   `-- template.php
    |           |   |   |   |   |   |-- frasi_mod_disp.php
    |           |   |   |   |   |   |-- funzioni_mod_disp.php
    |           |   |   |   |   |   |-- funzioni_modelli.php
    |           |   |   |   |   |   |-- modello_disponibilita.php
    |           |   |   |   |   |   `-- rat
    |           |   |   |   |   |       |-- form.php
    |           |   |   |   |   |       |-- functions.php
    |           |   |   |   |   |       |-- name.php
    |           |   |   |   |   |       |-- phrases.php
    |           |   |   |   |   |       `-- template.php
    |           |   |   |   |   |-- themes
    |           |   |   |   |   |   |-- sim
    |           |   |   |   |   |   |   |-- foot.php
    |           |   |   |   |   |   |   |-- head.php
    |           |   |   |   |   |   |   |-- inc
    |           |   |   |   |   |   |   |   |-- button.gif
    |           |   |   |   |   |   |   |   |-- functions.js
    |           |   |   |   |   |   |   |   `-- stylesheet.css
    |           |   |   |   |   |   |   |-- menu.php
    |           |   |   |   |   |   |   |-- name.php
    |           |   |   |   |   |   |   `-- selectperiod.php
    |           |   |   |   |   |   `-- snj
    |           |   |   |   |   |       |-- foot.php
    |           |   |   |   |   |       |-- head.php
    |           |   |   |   |   |       |-- inc
    |           |   |   |   |   |       |   `-- button.gif
    |           |   |   |   |   |       |-- menu.php
    |           |   |   |   |   |       |-- name.php
    |           |   |   |   |   |       `-- selectperiod.php
    |           |   |   |   |   `-- variabili_contratto.php
    |           |   |   |   |-- index.html
    |           |   |   |   |-- inizio.php
    |           |   |   |   |-- interconnessioni.php
    |           |   |   |   |-- inventario.php
    |           |   |   |   |-- messaggi.php
    |           |   |   |   |-- modifica_app.php
    |           |   |   |   |-- modifica_cliente.php
    |           |   |   |   |-- modifica_contratto.php
    |           |   |   |   |-- modifica_costi.php
    |           |   |   |   |-- modifica_ospiti.php
    |           |   |   |   |-- modifica_prenota.php
    |           |   |   |   |-- modifica_var_contr.php
    |           |   |   |   |-- personalizza.php
    |           |   |   |   |-- prenota.php
    |           |   |   |   |-- prezzi.htm
    |           |   |   |   |-- privilegi_utenti.php
    |           |   |   |   |-- storia_soldi.php
    |           |   |   |   |-- tab_tariffe.php
    |           |   |   |   |-- tabella.php
    |           |   |   |   |-- tabella2.php
    |           |   |   |   |-- tabella3.php
    |           |   |   |   |-- visualizza_contratto.php
    |           |   |   |   `-- visualizza_tabelle.php
    |           |   |   |-- reservation.php
    |           |   |   |-- sfondi-bandiera-francia.gif
    |           |   |   |-- sfondi-bandiera-gran-bretagna.gif
    |           |   |   |-- sfondi-bandiera-italia.gif
    |           |   |   |-- sfondi-bandiera-spagna.gif
    |           |   |   |-- swfobject.js
    |           |   |   `-- thumbnails
    |           |   |       |-- 081.jpg
    |           |   |       |-- 086.jpg
    |           |   |       |-- 089.jpg
    |           |   |       |-- 091.jpg
    |           |   |       |-- 093.jpg
    |           |   |       |-- 100_0608.jpg
    |           |   |       |-- 100_0609.jpg
    |           |   |       |-- 100_0610.jpg
    |           |   |       |-- 100_0612.jpg
    |           |   |       |-- 114.jpg
    |           |   |       |-- bagno.jpg
    |           |   |       |-- camera.jpg
    |           |   |       |-- cucina.jpg
    |           |   |       |-- entrata.jpg
    |           |   |       |-- entrata1.jpg
    |           |   |       |-- entrata2.jpg
    |           |   |       |-- imancio_092.jpg
    |           |   |       |-- index.jpg
    |           |   |       |-- index1.jpg
    |           |   |       |-- salotto.jpg
    |           |   |       `-- visuale.jpg
    |           |   |-- Giusy B&B Bck 19092009.rar
    |           |   `-- Giusy_B&B_Bck_old.rar
    |           |-- Varie
    |           |   |-- New photo B&B
    |           |   |   |-- 100_0607.JPG
    |           |   |   |-- 100_0608.JPG
    |           |   |   |-- 100_0609.JPG
    |           |   |   |-- 100_0610.JPG
    |           |   |   `-- 100_0612.JPG
    |           |   |-- b&b.doc
    |           |   |-- contratto.pdf
    |           |   |-- images
    |           |   |   |-- Thumbs.db
    |           |   |   |-- bagno.jpg
    |           |   |   |-- camera.jpg
    |           |   |   |-- cucina.jpg
    |           |   |   |-- entrata.jpg
    |           |   |   |-- entrata1.jpg
    |           |   |   |-- entrata2.jpg
    |           |   |   |-- index.jpg
    |           |   |   |-- index1.jpg
    |           |   |   |-- salotto.jpg
    |           |   |   `-- visuale.jpg
    |           |   `-- immagini
    |           |       |-- 081.jpg
    |           |       |-- 082.jpg
    |           |       |-- 083.jpg
    |           |       |-- 084.jpg
    |           |       |-- 085.jpg
    |           |       |-- 086.jpg
    |           |       |-- 087.jpg
    |           |       |-- 088.jpg
    |           |       |-- 089.jpg
    |           |       |-- 090.jpg
    |           |       |-- 091.jpg
    |           |       |-- 092.jpg
    |           |       |-- 093.jpg
    |           |       |-- 094.jpg
    |           |       |-- 095.jpg
    |           |       |-- 096.jpg
    |           |       |-- 097.jpg
    |           |       |-- 098.jpg
    |           |       |-- 099.jpg
    |           |       |-- 100.jpg
    |           |       |-- 101.jpg
    |           |       |-- 102.jpg
    |           |       |-- 103.jpg
    |           |       |-- 104.jpg
    |           |       |-- 105.jpg
    |           |       |-- 106.jpg
    |           |       |-- 107.jpg
    |           |       |-- 108.jpg
    |           |       |-- 109.jpg
    |           |       |-- 110.jpg
    |           |       |-- 111.jpg
    |           |       |-- 112.jpg
    |           |       |-- 113.jpg
    |           |       |-- 114.jpg
    |           |       |-- 115.jpg
    |           |       |-- 116.jpg
    |           |       |-- 117.jpg
    |           |       |-- 118.jpg
    |           |       |-- 119.jpg
    |           |       |-- 120.jpg
    |           |       |-- 121.jpg
    |           |       |-- 122.jpg
    |           |       |-- 123.jpg
    |           |       |-- IMancio 065.jpg
    |           |       |-- IMancio 071.jpg
    |           |       |-- IMancio 092.jpg
    |           |       |-- IMancio 099.jpg
    |           |       |-- IMancio 157.jpg
    |           |       |-- iMancio 069.jpg
    |           |       |-- iMancio 104.jpg
    |           |       |-- iMancio 144.jpg
    |           |       |-- iMancio 160.jpg
    |           |       `-- iMancio 171.jpg
    |           |-- Volantino.pub
    |           |-- b&b indicazioni da pisa.eml
    |           |-- biglietto da visita.pub
    |           |-- dati.txt
    |           |-- dati.txt.bak
    |           |-- descrizione.txt
    |           |-- descrizione.txt.bak
    |           |-- find_us_on_facebook_badge.gif
    |           `-- pwd.txt
    |-- mail-bb
    |   |-- cur
    |   |   `-- 1258580639.30793_1.neo:2,S
    |   |-- dovecot-keywords
    |   |-- dovecot-uidlist
    |   |-- dovecot-uidvalidity
    |   |-- dovecot-uidvalidity.4ad9e6fe
    |   |-- dovecot.index
    |   |-- dovecot.index.cache
    |   |-- dovecot.index.log
    |   |-- new
    |   |-- subscriptions
    |   `-- tmp
    `-- mail-mancio
        |-- cur
        |   |-- 1258715827.20512_1.neo:2,S
        |   |-- 1258800370.10081_1.neo:2,RSc
        |   |-- 1258844648.5968_1.neo:2,STa
        |   `-- 1258848847.8633_1.neo:2,STa
        |-- dovecot-keywords
        |-- dovecot-uidlist
        |-- dovecot-uidvalidity
        |-- dovecot-uidvalidity.4ad2069e
        |-- dovecot.index
        |-- dovecot.index.cache
        |-- dovecot.index.log
        |-- new
        |-- subscriptions
        `-- tmp

42 directories, 415 files
 
Old 11-30-2009, 08:41 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Slackware 13.37, Debian Squeeze
Posts: 7,964
Blog Entries: 25

Rep: Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009
That's a lot of information!

Can you reproduce the problem with a very cut down version of the script, something like
Code:
#!/bin/bash

tar vzcf /backup/test.tgz --listed-incremental=/var/log/backup/log_backup_incrementale/incrementale.tarlog '/home/neo/Documenti/Documenti/B&B' 2>> /backup/log_errori >> /backup/log
That way we can focus more easily on the actual command which is causing the problem and explore why it is behaving differently when called from command line and from cron.

EDIT: it might help to see the crontab line, too.
 
Old 12-05-2009, 06:45 PM   #8
m.mancio
LQ Newbie
 
Registered: Oct 2009
Posts: 11

Original Poster
Rep: Reputation: 0
hi,
I've try with simple command tar via cron and works! I'm going to rewrite my script, more simple. But it's very very strange that via cron tar write only folder and via shell all it's ok.... It's easy to understand if any work (problem with path or permission) but if write only the folder... MAH (italian slang for I don't know)!

Thanks catkin for suggestion! Mauro

p.s.


# Backup full
19 11 * * * sh /scripts/backup.sh
 
Old 12-06-2009, 05:48 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Slackware 13.37, Debian Squeeze
Posts: 7,964
Blog Entries: 25

Rep: Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009
It may also help identify the root cause of the problem if you tried changing the first line of your original script to
Code:
#!/bin/bash -l
That's a letter l, for "login", and will have the effect of running your login shell startup files; if this fixes the problem you know the root cause of the problem is something that is not set up when running from cron but is set up by your login shell startup files.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron appears to be messed up (E: cron: subprocess post-installation script returned e bujutsukai Linux - Newbie 1 07-24-2008 03:39 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
script & cron szandor Programming 5 04-19-2007 11:11 PM
script execution: startup & cron alanvee Linux - Software 3 02-17-2006 01:49 PM
bash script & cron probs. skubik Programming 17 10-16-2005 02:00 PM


All times are GMT -5. The time now is 02:11 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration