- Community Home
- >
- Servers and Operating Systems
- >
- Legacy
- >
- HPE 9000 and HPE e3000 Servers
- >
- Re: ftp in cron fails, from command works OK
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-20-2005 03:52 AM
тАО10-20-2005 03:52 AM
ftp in cron fails, from command works OK
Attaching a shell script which works OK from command line but not in cron. It is just the ftp piece which is failing. Can you please help. TIA
Ragu
Script to send email on the DBA Aud files
#
#
#############################################
#!/usr/bin/ksh
set -x
dtenum=`date +%m%d%y`
integer wknum=$dtenum/7
echo $wknum
check_stat=`/usr/bin/find /u01/oracle/admin/fidev/audit -name "*.aud" -exec ls -
l {} \; | wc -l`;
echo $check_stat
orcl=`expr $check_stat`
if [ $orcl -ge 2 ]
then
else
1/oracle/admin/fidev/audit -name "*.aud"`
echo "no Audit file present"o" test@mydomain.com,test2@mydomain.com < /
01/oracle/admin/fidev/audit/edf$dtenum.tar
fi
a1.sh (70%)
echo "FTPing...."
/usr/bin/ftp -n hulk << EOF
user corp/\ragu test
cd /group/it/sox/midas/
bin
mput *.tar
bye
EOF
#/usr/bin/find /u01/oracle/admin/fidev/audit -name "*.aud" -exec rm {} \;
#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-20-2005 04:32 AM
тАО10-20-2005 04:32 AM
Re: ftp in cron fails, from command works OK
I suspect the problem is due to the very sparse environment that a cron session receives.
Try sourcing the appropriate user's .profile early in the script to insure you have an equivalent environment that you'd have in a shell session. All cron scripts should really do this.
HTH,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-20-2005 07:20 AM
тАО10-20-2005 07:20 AM
Re: ftp in cron fails, from command works OK
echo "user username password
cd /group/it/sox/midas/
bin
mput *.tar
bye" | ftp -i -n hulk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-2005 04:24 AM
тАО10-21-2005 04:24 AM
Re: ftp in cron fails, from command works OK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-2005 04:48 AM
тАО10-21-2005 04:48 AM
Re: ftp in cron fails, from command works OK
/usr/bin/ftp -n hulk << EOF
user corp/\ragu test
cd /group/it/sox/midas/
bin
prompt
mput *.tar
bye
EOF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-2005 06:38 AM
тАО10-21-2005 06:38 AM
Re: ftp in cron fails, from command works OK
Ragu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-23-2005 04:02 AM
тАО10-23-2005 04:02 AM
Re: ftp in cron fails, from command works OK
I think, Jeff is right, the problem is in the environment. I'm afraid that the command a1.sh is not in the PATH, which crontab provides the script. In all cron scripts one must use full path, excluding the commands from /bin and /usr/bin.
Additionally, if you want to use ftp from a script, you can use ~/.netrc file, as follows:
machine ftpserver
login username
password userpasswd
macdef init
bin
get backup.tar.gz
quit
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-23-2005 04:16 AM
тАО10-23-2005 04:16 AM
Re: ftp in cron fails, from command works OK
Ragu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-24-2005 02:02 PM
тАО10-24-2005 02:02 PM
Re: ftp in cron fails, from command works OK
Ragu