Help running a script in linux

Hi

I have a red hat 8 server and I have this script in a file named backup.sh

zip -ur9 /home/backup/ArchiverosTIN.zip -t $(date +%m01%Y) /home/Archiveros/ -x@/home/backup/excluir.txt
zip -r9 /home/backup/ProscaiTIN_$(date +%d%m%Y_%H-%M).zip /home/Archiveros/Archivos/PROSCAI/

when I run the command "sh backup.sh" everything is fine, and the backup is done and I get 2 zip files

I added a line to the crontab file to run this script automatically every day at midnight, and the backup starts as spected, but It never finish, I only get one incomplete zip file (it is incomplete 'cos it has a random name , no extension, and its about 30 MB when it should be about 200)

does some one know why?

thanks
LVL 13
rettiseertAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
giltjrConnect With a Mentor Commented:
I woud suggest adding:

     1> OutA.txt 2> ErrorA.txt
     1> OutB.txt 2> ErrorB.txt

To the end of each command respesctively.  The Out files will contain the STDOUT messages and the Error files will contain the STDERR messages.  This may give you an idea of what is working and what is failing.
0
 
ygouthamCommented:
use the full path to zip

put it in as

/usr/bin/zip -r9 blah blah blah

0
 
rettiseertAuthor Commented:
actually, it was a network problem, at midnight the samba service was stopped and seems that tha caused the problem

giltjr suggestion was very hepulf thanks
0
 
giltjrCommented:
Gald to see you solved the problem.  Although I personally would not call it a network problem.  If service is stopped, it is not a network issue that it can't be accessed.  :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.