LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cron script troubles (https://www.linuxquestions.org/questions/linux-newbie-8/cron-script-troubles-279461/)

Galphar 01-18-2005 06:35 PM

Cron script troubles
 
What I am trying to do is use a script to upload a gameserver log to a webserver and then have it run the parser over the internet. The script I have works for doing this, but when I set up a cron job to run the script every 12 hrs it doesn't upload the log for me.

Here is the script:

#/bin/sh
ftp -n -v www.bls4sof.com </home/galphar/.sof2/rocmod/ftpcmds.txt> /home/galphar/.sof2/rocmod/ftpupdate.log
wget http://www.bls4sof.com/Stats/fragland/UltraStats/bin/update.php
wget http://www.bls4sof.com/Stats/fragland/UltraStats/bin/update.php
wget http://www.bls4sof.com/Stats/fragland/UltraStats/bin/update.php
wget http://www.bls4sof.com/Stats/fragland/UltraStats/bin/update.php
wget http://www.bls4sof.com/Stats/fragland/UltraStats/bin/update.php


I tried adding the line cd /home/galphar/.sof2/rocmod to beginning of the script but then i get this output:

[galphar@BLS4SOF rocmod]$ ./update1.sh
: No such file or directoryhome/galphar/.sof2/rocmod
--16:20:42-- http://www.bls4sof.com/Stats/fragland/UltraStats/bin/update.php%0D
=> `update.php%0D'
Resolving www.bls4sof.com... done.
Connecting to www.bls4sof.com[12.10.101.24]:80... connected.
HTTP request sent, awaiting response... 400 Bad Request
16:20:42 ERROR 400: Bad Request.

--16:20:42-- http://www.bls4sof.com/Stats/fragland/UltraStats/bin/update.php%0D
=> `update.php%0D'
Resolving www.bls4sof.com... done.
Connecting to www.bls4sof.com[12.10.101.24]:80... connected.
HTTP request sent, awaiting response... 400 Bad Request
16:20:42 ERROR 400: Bad Request.

--16:20:42-- http://www.bls4sof.com/Stats/fragland/UltraStats/bin/update.php%0D
=> `update.php%0D'
Resolving www.bls4sof.com... done.
Connecting to www.bls4sof.com[12.10.101.24]:80... connected.
HTTP request sent, awaiting response... 400 Bad Request
16:20:42 ERROR 400: Bad Request.

--16:20:42-- http://www.bls4sof.com/Stats/fragland/UltraStats/bin/update.php%0D
=> `update.php%0D'
Resolving www.bls4sof.com... done.
Connecting to www.bls4sof.com[12.10.101.24]:80... connected.
HTTP request sent, awaiting response... 400 Bad Request
16:20:42 ERROR 400: Bad Request.

--16:20:42-- http://www.bls4sof.com/Stats/fragland/UltraStats/bin/update.php%0D
=> `update.php%0D'
Resolving www.bls4sof.com... done.
Connecting to www.bls4sof.com[12.10.101.24]:80... connected.
HTTP request sent, awaiting response... 400 Bad Request
16:20:42 ERROR 400: Bad Request.

Any help on this would be highly appreiciated.

student04 01-19-2005 02:32 PM

If the script works fine, then your syntax for the cron job would be incorrect.. how did you add it, and what did you type? crontab -e will bring up the crontab file associated with the username that invoked it. Here is the syntax (copied from my crontab file)
Code:

# Minute  Hour  Day  Month  DayOfWeek  Command
# sample:
05 13  *  *  Mon  /usr/bin/updatedb

This would run /usr/bin/updatedb at 1:05 PM every monday of the year. So to have your script run every 12 hours the syntax might look something like this:
Code:

00  00  *  *  *  cd /path/to/folder/ && sh yourScript.sh
00  12  *  *  *  cd /path/to/folder/ && sh yourScript.sh



All times are GMT -5. The time now is 06:37 AM.