linux - perl not executing in cron -


ok i'm pull hair out. have perl script not run in crontab have written perl script runs fine every day on same box. have checked of given solutions on site , others around web , nothing seems make difference. here cron , first part of script

55 13 * * * su oracle; cd /u02/oraclebackup;./move_em_bkup.pl >> /u02/oraclebackup/move_em_backup.log > move_em_bkup.dbg 2>$1 

it touches .dbg file not put in there. there no errors or can use go by.

#!/usr/bin/perl use strict; use archive::tar; use net::scp qw/ scp /; use net::scp::expect; use datetime; 

can help?

the command you're running is:

su oracle; cd /u02/oraclebackup; ... 

su oracle launches interactive shell under oracle account (assuming have permission so). i'm not sure in non-interactive cron environment, assuming works, cd /u02/oraclebackup , following sub-commands executed after shell terminates, i.e., under account owns crontab. su oracle either block rest of command or nothing.

you can use su -c command run command specified user. in case, you'd want like:

su -c oracle sh -c 'cd /u02/oraclebackup; ...' 

or change su su - if need oracle account's login environment.

better yet, drop su , put whole thing in oracle account's crontab. might still need play more tricks environment right; cron jobs run limited set of environment variables default.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -