Sponsored Content
Top Forums Shell Programming and Scripting Problem with ftp scripts and cron Post 302362466 by mokachoka on Friday 16th of October 2009 05:39:32 AM
Old 10-16-2009
Problem with ftp scripts and cron

Need some help / advice with the follow script...

Basically i have an FTP server that connects to other ftp servers and sends and downloads files every few hours or so. There are 12 different accounts that all have 2 scripts each, one to send and one to receive. Below is an example send script for one account. There all the same, just the top variables are changed...

I have put these all in cron to run at certain times but after activating all of them and checking it in the morning it was hanging on connection (ssh)... i managed to get in but was greeted with a number of CRON memory error messages... it seems if the jobs are running into some sort of error they are running again exactly 1min later... how can i stop this???

Any help is appreciated Smilie



Code:
#!/bin/sh
HOST=***
USER="***"
PASS="***"
ACCOUNT=***
REMOTE_DIRECTORY=***
 
lftp -u ${USER},${PASS} sftp://${HOST} <<EOF
lcd /home/ftp/$ACCOUNT/ftptransfer/outgoing
cd $REMOTE_DIRECTORY
mput *
bye
EOF
 
# Sends title to log file
echo "-------send-------" >> /home/ftp/$ACCOUNT/ftptransfer/log/log.txt
 
# Sends date to log file
date >> /home/ftp/$ACCOUNT/ftptransfer/log/log.txt
# Count how many files are inside outgoing
 
echo "Number of files inside outgoing :" >> /home/ftp/$ACCOUNT/ftptransfer/log/log.txt
 
ls -l /home/ftp/$ACCOUNT/ftptransfer/outgoing | grep ^- | wc -l >> /home/ftp/$ACCOUNT/ftptransfer/log/log.txt
 
# List the files that have just been sent
echo "List of files that have just been sent :" >> /home/ftp/$ACCOUNT/ftptransfer/log/log.txt
ls /home/ftp/$ACCOUNT/ftptransfer/outgoing >> /home/ftp/$ACCOUNT/ftptransfer/log/log.txt
 
# Moves the files from outgoing to archived
mv /home/ftp/$ACCOUNT/ftptransfer/outgoing/* /home/ftp/$ACCOUNT/ftptransfer/archived
 
# Counts how many files are inside archived
echo "Number of files inside archived :" >> /home/ftp/$ACCOUNT/ftptransfer/log/log.txt
ls -l /home/ftp/$ACCOUNT/ftptransfer/archived | grep ^- | wc -l >> /home/ftp/$ACCOUNT/ftptransfer/log/log.txt
 
# Line break to log file
echo "" >> /home/ftp/$ACCOUNT/ftptransfer/log/log.txt



---------- Post updated at 04:39 AM ---------- Previous update was at 04:33 AM ----------

The error message is along the lines of (sorry i forgot most of it)

out of memory kill process cron score

Last edited by Franklin52; 10-16-2009 at 06:49 AM.. Reason: Please use code tags!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help in cron scripts

Hi, i have scheduled my scripts in cron, some time the script doesn't runs ..which will impact me a lot, can some one help me such that mail has to come stating script has run successfully/unsuccessful any help will be appreciated.. thanks in advance, geeko (0 Replies)
Discussion started by: geeko
0 Replies

2. Shell Programming and Scripting

Issue calling scripts through CRON.

I have the following cron job in the crontab. #! /bin/bash 25 15 * * 1-5 /export/home/svittala/scripts/scpt1.sh >/dev/null 2>&1. The problem that I am facing is - the scpt1.sh can be executed manually. But, it is not executing through CRON. Not sure what's the issue. Any hints?. Thanks.... (5 Replies)
Discussion started by: vskr72
5 Replies

3. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log The checkstatus.sh scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

4. Shell Programming and Scripting

Running 2 scripts one after the other using cron

I would like to run two scripts using cron one immediately after the other. Is it enough to put them one after another in the cron file to run at the same time, or will this cause them to run concurrently? (4 Replies)
Discussion started by: 3210
4 Replies

5. Shell Programming and Scripting

Cron and multiple scripts problem.

Hello All, I have 3 scripts namingly 1X 2X and 3X. I have one directory ABC created which contains some 40 sub directories. I have one input file in the below format.The input file resides in ABC directory. Inputfile format; subdirectoryname date subdirectoryname1 date subdirectoryname2... (1 Reply)
Discussion started by: RSC1985
1 Replies

6. UNIX for Dummies Questions & Answers

Cron changing folder for scripts

I would like to ask if cron when running a planned script changes the current folder for the script. Thank you! (2 Replies)
Discussion started by: MartyIX
2 Replies

7. Solaris

running scripts from cron

I need to run a script (from cron) that runs a second script. What worries me is that second script, when run from bash, upon finishing doesn't return to bash unless I press the 'Enter' key. I presume that's because last command in that script ends with & Could that be a problem for cron?... (2 Replies)
Discussion started by: orange47
2 Replies

8. UNIX for Advanced & Expert Users

Running multiple php scripts into one php only, cron mail alert problem...

hi, while separated they produce the usual mail alert and i can see the output... if i write into the php script: <?php system('php -f /var/www/vhosts/domain.com/httpdocs/folder/script1.php'); system('php -f /var/www/vhosts/domain.com/httpdocs/folder/script2.php'); system('php -f... (0 Replies)
Discussion started by: 7stars
0 Replies

9. AIX

Cron scripts security

Hello everyone, I have an AIX 6.1 machine and i experienced a problem with my cron scripts. It appears that somebody renamed a cron script so crontab could not execute it. Is there a way to put some security on cron scripts so nobody else except root can rename or delete a cron script? Or they... (6 Replies)
Discussion started by: omonoiatis9
6 Replies

10. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies
ftpconfig(1M)						  System Administration Commands					     ftpconfig(1M)

NAME
ftpconfig - set up anonymous FTP SYNOPSIS
ftpconfig [ftpdir] ftpconfig -d ftpdir DESCRIPTION
The ftpconfig script is executed by the super user to set up anonymous FTP. Anonymous FTP allows users to remotely log on to the FTP server by specifying the user name ftp or anonymous and the user's email address as password. The anonymous users are logged on to the FTP Server and given access to a restricted file area with its own file system root. See chroot(2). The FTP area has its own minimal system files. This command will copy and set up all the components needed to operate an anonymous FTP server, including creating the ftp user account, creating device nodes, copying /usr/lib files, and copying timezone data. The passwd and group files set up have been stripped down to prevent malicious users from finding login names on the server. The anonymous file area will be placed under ftpdir. If the ftp user account already exists, then the current FTP area is used, and the system files in it are updated. All other files are left untouched. This command should be run to update the anonymous FTP area's configuration whenever a system patch is installed, or the system is upgraded. OPTIONS
-d Create a new or update an existing ftpdir without creating or updating the ftp user account. Use this option when creating guest FTP user accounts. OPERANDS
The following operands are supported: ftpdir The absolute pathname of the directory under which the anonymous FTP area is set up. EXIT STATUS
The following exit values are returned: 0 Successful completion 1 Improper usage of the command 2 Command failed ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWftpu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
ftpaddhost(1M), in.ftpd(1M), useradd(1M), chroot(2), attributes(5) SunOS 5.10 1 May 2003 ftpconfig(1M)
All times are GMT -4. The time now is 01:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy