LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problem in shell scripting (https://www.linuxquestions.org/questions/linux-newbie-8/problem-in-shell-scripting-132040/)

visu 01-06-2004 09:31 AM

problem in shell scripting
 
Hello all,
I have problem in my backup script (backup.home)
The following line in backup.home script file

/usr/local/bin/growisofs -Z /dev/cdrom1 /backup/*.dar this line included in one script called backup.home

if i run backup.home in console that line just ignore warnings and running

but if i place backup.home in cron job then that line give error

Anyone have any idea about my problem ?

Thanx in advance

druuna 01-06-2004 09:45 AM

What is the error???

If your script generates output and doesn't have a terminal, things can go wrong. This could be your problem (running from the commandline, you have a terminal. If run from cron, you don't have a terminal). But all this is just a guess, 'cause you don't tell us what is going wrong.

visu 01-06-2004 10:05 AM

Hello thanx for ur response.

Actually the script is for daily backups in DVD+RW media. So i am using growisofs to write the backups file which comes out from DAR tool to DVD+RW media. Backup files extension has .dar

Backup script name is "backup.home" it contains the following line to write the backup files in DVD+RW media.

/usr/local/bin/growisofs -Z /dev/cdrom1 /backup/*.dar

Actually inserted DVD+RW media has already datas. But every time this script overwrites the current backup files to DVD+RW media, so exisiting datas out and writing current datas in media.

this works fine if DVD+RW media has no exisit datas and also with datas if run this script from console like ./backup.home

But this script wont write datas in DVD+RW media if place this script in cron job.

i want to know how to write this line

/usr/local/bin/growisofs -Z /dev/cdrom1 /backup/*.dar

to ignore warnings and error this growisofs continuous to write datas in DVD+RW media.

I hope now u understand my probs.

Hope u have some idea about it.

regards,
visu

computergeek84 01-06-2004 12:03 PM

Does this command

/usr/local/bin/growisofs -Z /dev/cdrom1 /backup/*.dar

produce any output to stdout or stderr (text you see on the screen)?


If so, then try this for your cron job:

/usr/local/bin/growisofs -Z /dev/cdrom1 /backup/*.dar > /dev/null 2>&1

to throw away all the text it would print in the terminal and redirect the filestreams into the bit bucket. This may be the reason that it works in the terminal but not in cron.

visu 01-06-2004 04:16 PM

Hello computergeek84
Thanx for ur reply. The following command which u mentioned, just says no error, but it will not do its job, just come out of this growisofs command.

/usr/local/bin/growisofs -Z /dev/cdrom1 /backup/*.dar > /dev/null 2>&1

But i am happy now bcs the following dirty trick command works for me now

/usr/local/bin/growisofs -Z /dev/cdrom1 /backup/*.dar < /dev/tty13

It works fine with warnings message in cron job.

Thanks for friends who helped me out.

regards
visu


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