Operating System - HP-UX
1833497 Members
2668 Online
110052 Solutions
New Discussion

Can't open /dev/tty to prompt for more media.

 
SOLVED
Go to solution
GrayMatter_1
Advisor

Can't open /dev/tty to prompt for more media.

OK, I've come across other threads on this that say this is caused because the tape is full, but I know that is not the case. I think this is some other buffer filling up but I am not sure what.

background: every night a cron job runs to backup folders to another drive. The size of the folders being backed up is 3369128 as reported by `du -s' and the free space on the destination drive is 20680464 as reported by `bdf'. When cron runs the tar command, it prints the name every file that is going into it... I think that if i could just suppress that output that it may fix the issue. the email i get from cron is usually about 1mb.

Thanks for all your help!

Cheers!
GM
5 REPLIES 5
Tim Nelson
Honored Contributor

Re: Can't open /dev/tty to prompt for more media.

What are you using to copy/backup the files ?

Does the script running from cron send the output to std out ? If so just redirect to a log file .
GrayMatter_1
Advisor

Re: Can't open /dev/tty to prompt for more media.

I haven't been able to redirect output from tar successfully to a log file.
below is the script that is running. I'm sure that it is sending output to std out and that is the problem.

Thanks for your help!


--Begin Script--

#!/bin/ksh
# backup script for Home directories

# create txt file containing start time
echo `date` >/backup/start_home.txt

# Remove old backup of home directory
echo Removing old home backup
rm -f /backup/home.tar
# Backup home directory
echo TAR home directory
cd "/backup" && exec time tar -cvf /backup/home.tar /home
# Approx run times from testing
# real 1:15:51.4
# user 7.5
# sys 9.1

# create txt file containing end time
echo `date` >/backup/end_home.txt
Bill Costigan
Honored Contributor

Re: Can't open /dev/tty to prompt for more media.

Have you tried leaving off the 'v' in the tar command?

Have you tried putting quotes around the tar

e.g. exec time 'tar -cvf home.tar /home > /tmp/tar_out.txt'

You didn't give any details about your problems redirecting the output so I'm guessing that the command parser was redirecting either exec or time's output.
Bill Hassell
Honored Contributor
Solution

Re: Can't open /dev/tty to prompt for more media.

Althjough the man page does not mention this, the -v option goes to stderr, not stdout. You can suppress the file names by simply removing the -v option as in:

cd "/backup" && exec time tar -cf /backup/home.tar /home

Or you can redirect tar's stderr output to /dev/null:

cd "/backup" && exec time tar -cvf /backup/home.tar /home 2>/dev/null

A cron job will always send email when there is anything for stdout or stderr.


Bill Hassell, sysadmin
GrayMatter_1
Advisor

Re: Can't open /dev/tty to prompt for more media.

Thanks all! I am testing a couple of the suggestions posted. I appreciate everyones help. I will assign points tonight.

Cheers!
GM.