LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-17-2005, 08:11 AM   #1
rickict
LQ Newbie
 
Registered: Jan 2005
Location: suffolk, england
Distribution: fedora core 3
Posts: 16

Rep: Reputation: 0
works on command not on cron


trying to automate back up scripts using cygwin and crontab.
the script works perfectly when i run it manually. but when i cron it
it only runs part of the script .

Code:
#!/bin/sh
# This shell script file backs up the data from SHARE
# -------------SCRIPT VARIABLES---------------
SHARE="//server/myshare";
DATADIR="myshare";
USERNAME="boggle"        #or notneeded
PASSWD="mypass";                   
BACKUPFILE="myshare";
#BACKUPDRIVE="/dev/hdc1";
BACKUPMP="/cygdrive/d/cacheback/";
SMBMP="/mnt/smb/";
# ---------------------------------------------
export PASSWD;
echo 'go------------------------------------------------------------------';
date;  

mount -f $SHARE $SMBMP ;#password=$PASSWD username=$USERNAME;
if (ls $SMBMP) then #removed $DATADIR
     echo "Backing up $SHARE";
     cd $SMBMP;
    
     rsync -vur $SMBMP $BACKUPMP$DATADIR/;

     cd /;
     
fi;
     umount $SMBMP;
when run from cron i only get it printing out go and the date and time
it cant do the mount jobs?
 
Old 11-17-2005, 02:52 PM   #2
ahedler
Member
 
Registered: Oct 2005
Location: A safe distance from Detroit
Distribution: SuSE 10.0, Knoppix
Posts: 99

Rep: Reputation: 17
In cron, you usually don't have an environment as you will in an interactive session, so paths are not established, among other things. You may be able to get it to work by specifying complete paths for every utility that you call, but I can't guarantee that this will make everything work. I need to read up on that some more.

-alan
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
btdownload*.py, works from Command Line, not from cron SkipHuffman Linux - Software 11 12-30-2005 02:55 PM
Command works on cmdline, not in cron? UrbanSlayer Linux - General 6 11-06-2005 11:14 AM
cron command alphamike Linux - Newbie 2 08-28-2005 12:04 AM
How to run my cron command ? Tanc Linux - Newbie 6 05-28-2005 04:58 PM
Help with a cron command phatboyz Linux - Software 2 01-19-2005 11:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:47 PM.

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