Operating System - HP-UX
1834454 Members
2509 Online
110067 Solutions
New Discussion

fbackup is returning an error code 1 when run on crontab but not when run from the command line

 
Managed Services
Frequent Advisor

fbackup is returning an error code 1 when run on crontab but not when run from the command line

When I run my fbackup script at the command prompt manually to my DLT device, it backs up my files as expected; however when I run the same script via crontab, it is failing straight away with an error code 1.
Any ideas/thoughts please?
HP-UX 11.00
Tape device is a Quantum DLT8000
command is fbackup -f /dev/rmt/1m -n -i . > 2>&1
8 REPLIES 8
Steven E. Protter
Exalted Contributor

Re: fbackup is returning an error code 1 when run on crontab but not when run from the command line

Cron has no environment. No PATH, no TERM, no nothing.

Most likely the fbackup command is not on the path.

Either set the path to include where fbackup is (whence fbackup) or use the full path for fbackup in the script.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sridhar Bhaskarla
Honored Contributor

Re: fbackup is returning an error code 1 when run on crontab but not when run from the command line

Hi Managed Services,

cron will be confused if you simply specify '.'. Add a meaningful path say "/". It's better to use -g option and specify a graph file with it. 'man fbackup' for more information.

fbackup -f /dev/rmt/1m -n -i / > 2>&1

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sridhar Bhaskarla
Honored Contributor

Re: fbackup is returning an error code 1 when run on crontab but not when run from the command line

And also look at your to see if it logged any information. You will also find a mail with the standard error sent by cron. Use 'elm' to look at the mail. As said by SEP, run it as /usr/sbin/fbackup so that PATH will be taken care.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Managed Services
Frequent Advisor

Re: fbackup is returning an error code 1 when run on crontab but not when run from the command line

Hi, thanks for the replies...

However, I have the exact same script running to back up the same data, on the same server, to a DDS drive and this runs perfectly.

The only difference between the two scripts, is the /0m (DDS) and /1m (DLT) I direct the data to. It worth mentioning that the scripts run at seperate times.

It is also worth mentioning that the fbackup for the DLT does actually run, but according to a custom log output I use, the backup starts and stops instantly.

When I run the command manually, the backup runs without a problem.

Thanks.
Bill Hassell
Honored Contributor

Re: fbackup is returning an error code 1 when run on crontab but not when run from the command line

cron does not login, so all your environment variables that you have when you run the command manually do not exist. So the -i . will be indeterminate in cron, but will seem to work OK when you login. ALWAYS specify a full path for -i as in: -i /var or -i / for a full backup.

I would add several options so you can see what is happening, and also add a config file to significantly speed up the backup process:

-V /var/adm/fbackupVolumeHeader.log
-I /var/adm/fbackupIndex.log
-c /etc/fbackupConfig

The fbackupConfig file should contain:

blocksperrecord 512
records 64
checkpointfreq 1024
readerprocesses 6
maxretries 5
retrylimit 5000000
maxvoluses 200
filesperfsm 2000

Look in your logfiles for error messages from cron. But don't try the full backup at some late hour. Schedule the backup for a few minutes in the future, change crontab and then see what happened.


Bill Hassell, sysadmin
Managed Services
Frequent Advisor

Re: fbackup is returning an error code 1 when run on crontab but not when run from the command line

Thanks for the replies all!

We have finally managed to get the backup working, the config settings seem to have done the trick.

We are, however, having an issue with the verification. The verification start and stop times are the same... Any idea why this is so?

Thank you
- Peter
Bill Hassell
Honored Contributor

Re: fbackup is returning an error code 1 when run on crontab but not when run from the command line

Verification? What does that mean? Are you running frecover -N to read the entire tape and verify the internal checksums? Post the actual command(s) and error(s) so we know what is happening.


Bill Hassell, sysadmin
Managed Services
Frequent Advisor

Re: fbackup is returning an error code 1 when run on crontab but not when run from the command line

The command is
/usr/sbin/frecover -r -vN -f $TAPE_DEV

I found the problem was that I didn't specify the full /usr/sbin path in the script, but this is fine now, thanks.

Regards
- Peter