LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Crontab Problem (https://www.linuxquestions.org/questions/linux-newbie-8/crontab-problem-379531/)

smus 11-03-2005 06:25 AM

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".

Emerson 11-03-2005 07:08 AM

> # bash service.sh

Why you have to run it like this? Do you have the executable bit set?

smus 11-03-2005 07:28 AM

No i only want to check wheter this script run correctly or not.
Soner

blindcoder 11-03-2005 09:25 AM

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

smus 12-10-2005 08:52 AM

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


All times are GMT -5. The time now is 02:04 AM.