LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-30-2012, 08:48 AM   #1
BlackLicht
LQ Newbie
 
Registered: Apr 2012
Posts: 4

Rep: Reputation: Disabled
Bash Process not killed when using crontab


Hi,

I am new to this form and to linux. (Sorry for my English)
I have 5 bash scripts written in bash.
It is a simple script that puts files on the internet, using ftp.
This scripts runs every 5 minutes and one script every 1 minute using crontab.
Code:
#!/bin/sh
# Run the weer update poller every 1 minutes
*/1 * * * * root /home/weerupdatelive.sh > /dev/null 2>&1
The files I put on the internet are not large and in several seconds the are on the internet.
When the script is done, not every time the process is killed.
After a week I have about 400 process running ftp.
Then I must use kill -9 to kill the process.
Is the a easier way to do this or to control the process using a pid file?

The script is simulaitr to this:
Code:
#!/bin/sh
# this script
user=user1@provider.com
password=password
basedir='/web/weergegevens'

ftp -n home.provider.com<<EOF
user ${user} ${password}
lcd ${basedir}
binary
prompt
mput mini_current*.*
mput aktuell*.*
mput instr_*.*
mput client*.txt
send wedaal.txt
send windbft_current.gif
send ws_realtime.txt
send kort.html
send metric.text
send barotrend.gif
send current.html
send custom.html
send datastation.php
send ddis_current.gif
send ddis_f_current.gif
send hetweeractueel.html
When I run this script manual it is done within 20 sec.
 
Old 04-30-2012, 09:01 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403
Hi and welcome to LQ!

First thing I noticed about the above script:
- the ftp session is not ended (no bye),
- the here-document doesn't end (no closing EOF).

Hope this helps.
 
1 members found this post helpful.
Old 04-30-2012, 10:05 AM   #3
BlackLicht
LQ Newbie
 
Registered: Apr 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Hi and tnx,

I have put the lines at the end of the file.
Is das not help.
Perhaps the FTP session is dead and the jobs is not stoped. (completed')
Not always. It is I think 50/50. Sometimes it stops and sometimes not.

Last edited by BlackLicht; 04-30-2012 at 10:06 AM.
 
Old 04-30-2012, 11:57 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 20,240

Rep: Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836Reputation: 6836
can you show what did you put at the end of the file?
 
Old 05-01-2012, 03:48 AM   #5
BlackLicht
LQ Newbie
 
Registered: Apr 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
Hi,

This is what I did:
Code:
bye
quit
EOF
Today I have taken a look at the "PS aux |grep ftp" and I see that there are only 19 process still running.
Is is not closed, perhaps hanging?
 
Old 05-01-2012, 04:08 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403Reputation: 2403
Hi,
Quote:
Originally Posted by BlackLicht View Post
This is what I did:
Code:
bye
quit
EOF
Remove the quit, it isn't needed.

You might also try to add the -i switch to the ftp command:
Code:
ftp -n home.provider.com<<EOF
vs
ftp -in home.provider.com<<EOF
The -i switch turns off interactive prompting during multiple file transfers.

Quote:
Today I have taken a look at the "PS aux |grep ftp" and I see that there are only 19 process still running.
Is is not closed, perhaps hanging?
I'm guessing that the ftp session isn't closed correctly, which will trigger a time-out on a none ftp level, which in turn defuncts the script/ftp process.

Hope this helps.
 
1 members found this post helpful.
Old 05-04-2012, 07:22 AM   #7
BlackLicht
LQ Newbie
 
Registered: Apr 2012
Posts: 4

Original Poster
Rep: Reputation: Disabled
I have done the changes. Still some running processes. But not 100's.
Also I think that the ftp session is not closed by error or something.
And deleted the line prompt.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why exactly was my process killed ??? qwerty47 Linux - Newbie 9 12-12-2013 12:08 AM
Oracle process being killed none00 Linux - Server 1 06-25-2008 08:13 AM
find history of a job killed by "kernel: Out of Memory: Killed process" poulacou Linux - Server 3 09-20-2007 04:24 PM
Why a process is Killed by OS ?? How To know the reason? shmulito Linux - Kernel 2 01-02-2007 01:06 AM
Killed Process Problem chr Slackware 2 05-06-2003 01:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration