Doesn't run as a cronjob...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Doesn't run as a cronjob...
# 1  
Old 06-07-2010
Doesn't run as a cronjob...

Hi!

I have a svn backup script that works perfectly if I execute it from the command line but if I set it as a cronjob to run at night, only part of the code works.

So, basically the scripts starts by deleting the folder yesterday and then moves the folder today to the folder yesterday. When that is finished it start the backup.

1st part
Code:
#!/bin/sh
date > begin.txt

rm -rv /network/ftp-backup/Svn/Yesterday/* 
wait
rm -rv /network/ftp-backup/Svn/svnbackup/Yesterday/.??*
wait
mv -v /network/ftp-backup/Svn/Today/* /network/ftp-backup/Svn/Yesterday/
wait
mv -v /network/ftp-backup/Svn/Today/.??* /network/ftp-backup/Svn/Yesterday/
wait

2nd part

Code:
ls -a /esp-server/svn/ > list.txt

cat list.txt | while read x; do
sudo svn-hot-backup /esp-server/svn/$x /network/ftp-backup/Svn/Today
wait

done

wait 

date > end.txt


the 1st part does not work from the cronjob table and the second part runs with no problems. I even split the scripts but it still does not run.

Any idea why?

thanks!

Moderator's Comments:
Mod Comment Please use CODE tags, not QUOTE tags, when posting code or listings

Last edited by pludi; 06-07-2010 at 08:02 AM..
# 2  
Old 06-07-2010
Who executes the job?
Who are you when executing the script interactively?

---------- Post updated at 15:25 ---------- Previous update was at 15:24 ----------

What OS?
# 3  
Old 06-07-2010
Quote:
Originally Posted by vbe
Who executes the job?
Who are you when executing the script interactively?

---------- Post updated at 15:25 ---------- Previous update was at 15:24 ----------

What OS?
1- Root
2- Root
3- Ubuntu 8.04 64bits Server Edition

Danke!
# 4  
Old 06-07-2010
I missed...

Code:
rm -rv /network/ftp-backup/Svn/Yesterday/* 
wait
etc...

You are not talking about NFS mounted filesystems are you?
# 5  
Old 06-08-2010
Quote:
Originally Posted by vbe
I missed...

Code:
rm -rv /network/ftp-backup/Svn/Yesterday/* 
wait
etc...

You are not talking about NFS mounted filesystems are you?
it was mounted with cifs...samba filesystem but what difference would this make?

Last edited by ruben.rodrigues; 06-08-2010 at 09:51 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Seeing unexpected results when i run through cronjob

Hi I'm having hard time here with below script. If i run script manually i see expected results but, if i keep this script in cron job i'm getting unexpected results. Unexpected results means even though condition is true,cronjob returning output of else condition. This script and cronjob... (2 Replies)
Discussion started by: buzzme
2 Replies

2. Shell Programming and Scripting

Run cronjob for every 10 minutes

Hi Friends, I have a requirement to run the cronjob for every 10 minutes from 2:00 AM to 6:00 AM. Does the below code works? If not, please advise. * * * * * command to be executed ┬ ┬ ┬ ┬ ┬ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └---------------------------------- day of week (0 - 6) (0 is... (5 Replies)
Discussion started by: srikanthbiradar
5 Replies

3. Shell Programming and Scripting

How to accomplished to run zenity in cronjob?

Hi, I would like to ask some few questions about zenity. I write a script that would generate a report if any changes on the files. i want to used zenity to had a visual alarm report if theres some changes on the comparisons of the file.I used this line of zenity but it doesn't work in cronjob.... (5 Replies)
Discussion started by: jao_madn
5 Replies

4. UNIX for Dummies Questions & Answers

Run a cronjob only when a file is modified?

Hello, I am new to cron. I have a cronjob that updates a dataset in a 3rd party application. The contents of this dataset come from a text file, which is updated irregularly. Currently my cronjob runs once every week, to update this dataset (irrespective of whether the file was updated or not).... (7 Replies)
Discussion started by: ad23
7 Replies

5. AIX

My script didn't run every run every minute at cronjob

In my cronjob, I would like to schedule my script.sh to run every minutes. I crontab -e and have in line below but it didn't seems to run at all. * * * * * script.sh When I run it manually, I can run it. Is that anything wrong with the above line? If I change it to something like below,... (4 Replies)
Discussion started by: ngaisteve1
4 Replies

6. Shell Programming and Scripting

Rerun a cronjob if it doesn't work at first.

I want to add a line to the script that searches for a file. If the file does not exist, I need to kill the cronjob and run it again in one hour. I am running the program and 2 am and 2pm. I would want the job to run again at 3am and 3pm respectively. How could I do this and still keep the cronjob... (1 Reply)
Discussion started by: libertyforall
1 Replies

7. UNIX for Dummies Questions & Answers

cronjob to run perl script

Hi all Recently i had finished a perl script. When i run manually, the script work fine. But when i wanted to put the script in cron, it didn't get the same output as it run manually. I felt that it only execute the script until certain line then it stop as i see most of the related files didn't... (6 Replies)
Discussion started by: AirWalker83
6 Replies

8. UNIX for Advanced & Expert Users

exec unable to run via cronjob

Hi , I write a script like this\ and put it under / (root) : ref=88 df -k | grep /cbmdata/00/gdd | tr -d '%' | \ while read a b c d e other do if (( $e >= $ref )) then line=`find /cbmdata/00/gdd -name "LOGS*" |sort -nr |tail -1` # echo $line rm -f $line fi done ... (11 Replies)
Discussion started by: xramm
11 Replies

9. UNIX for Advanced & Expert Users

cannot run cronjob

I have the following cron: 0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /v/sysadmin/sysnet/file.pl The .pl has been tried at 755 and 777 The script works if manually run by the web browser or unix command prompt, but I can't get the Cron to do it automatically i went... (3 Replies)
Discussion started by: shahrahulb
3 Replies

10. UNIX for Dummies Questions & Answers

Repquota doesn't work as Cronjob?!?

Hello: I'm trying to run repquota -ag > /home/usersdir/repquota.txt as a daily cronjob at midnight, but the file always ends up blank. I even tried writing a quick Perl script to e-mail me what running that command outputs, and it's nothing. Can root run repquota as a cronjob? Do I have... (1 Reply)
Discussion started by: b416
1 Replies
Login or Register to Ask a Question