LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-03-2005, 06:25 AM   #1
smus
Member
 
Registered: Nov 2005
Location: Turkey
Distribution: Suse
Posts: 104

Rep: Reputation: 16
Crontab Problem


Hi Everybody,

I am a newbie and i run a debian dist. my problem is to execute a shell script from the crontab daily i create the shell script which logins an ftp site and starts to download files (which are shell script like the crontab entry) after this process it excutes the both two downloaded script. This scripts work fine when i execute them in the command line by command # bash service.sh whenever i create the crontab entry with this script nothing works.

Thanks for your help,
Soner

My scrontab entry script is like this;
=======================================

#!/bin/bash/


ftp -n << EOT
open XXX.XXX.XXX.XXX
user user_name password
bin
get batch_upload.sh
get batch_rename.sh
bye
EOT

chmod 777 batch_upload.sh
chmod 777 batch_rename.sh
bash /usr/siglo/offline/batch_upload.sh
bash /usr/siglo/offline/batch_rename.sh
rm -f /usr/siglo/offline/batch_upload.sh
rm -f /usr/siglo/offline/batch_rename.sh

=======================================

my crontab entry is like this;
=======================================
0 5 * * * /usr/siglo/offline/service.sh
=======================================

ps : all my folder and file permission is set to "6777".
 
Old 11-03-2005, 07:08 AM   #2
Emerson
Senior Member
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~
Posts: 3,177

Rep: Reputation: Disabled
> # bash service.sh

Why you have to run it like this? Do you have the executable bit set?
 
Old 11-03-2005, 07:28 AM   #3
smus
Member
 
Registered: Nov 2005
Location: Turkey
Distribution: Suse
Posts: 104

Original Poster
Rep: Reputation: 16
No i only want to check wheter this script run correctly or not.
Soner
 
Old 11-03-2005, 09:25 AM   #4
blindcoder
ROCK Linux
 
Registered: Dec 2003
Location: Berlin, Germany
Distribution: Crystal ROCK
Posts: 108

Rep: Reputation: 15
Re: Crontab Problem

Quote:
Originally posted by smus
Code:
#!/bin/bash/


ftp -n  << EOT
open XXX.XXX.XXX.XXX
user user_name password
bin
get batch_upload.sh
get batch_rename.sh
bye
EOT

chmod 777 batch_upload.sh
chmod 777 batch_rename.sh
bash /usr/siglo/offline/batch_upload.sh
bash /usr/siglo/offline/batch_rename.sh
rm -f /usr/siglo/offline/batch_upload.sh
rm -f /usr/siglo/offline/batch_rename.sh
Try adding this line before the ftp run:
Code:
/usr/siglo/offline/
Also, to see what the script actually does, insert this line at the very beginning:
Code:
exec 2>&1
set -x
And post us the output from the cronjob. That information will help us helping you.

Greetings,
Benjamin
 
Old 12-10-2005, 08:52 AM   #5
smus
Member
 
Registered: Nov 2005
Location: Turkey
Distribution: Suse
Posts: 104

Original Poster
Rep: Reputation: 16
Hi EveryBody,
I found what is wrong with the batch;
The daemon cron dont know about the chmod, ftp or other command because you lost the users crediantials when signout from the session so you must teach the cron daemon the commands that you already use in the batch.

So the ftp -n << EOT line will be like this after changes /usr/bin/ftp -n << EOT you can find the exact path by using which command.

Thanks for your extra kindness and great help,
Best Regards
 
  


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
crontab problem pdrobe Red Hat 1 02-05-2005 03:19 PM
crontab problem provo1234 Linux - General 3 01-21-2005 11:20 AM
Problem with crontab PierrePau Linux - Software 3 06-28-2004 02:34 PM
crontab problem BlackRabbit Linux - General 9 06-17-2004 07:38 AM
crontab problem TomTheNewbie Slackware 1 07-09-2003 07:12 AM


All times are GMT -5. The time now is 11:44 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration