LinuxQuestions.org
Review your favorite Linux distribution.
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 09-03-2014, 09:36 AM   #1
monketrip28
LQ Newbie
 
Registered: Jun 2014
Posts: 2

Rep: Reputation: Disabled
Unhappy cron job do not work for copying files over the network


hi guys,
The following cornjobs does not copy files as it intend to do...
#! /bin/bash
echo "Rsync - MA Inbound Files"
rsync -rvu /media/hdd2/MA-Inbound /media/miracle/
echo "Completed MA Inbound Files Sync, Starting Tally.ERP 9 Data File Sync"

rsync -rvu /media/hdd2/Tally.ERP9 /media/miracle/
echo "Completd Tally.ERP9 Data File Sync, Starting 2011 Accounts Files Sync"

rsync -rvu /media/hdd2/"2011 Accounts" /media/miracle/
echo "Completd 2011 Accounts Files Sync, Starting 2012 Accounts Files Sync"

rsync -rvu /media/hdd2/"2012 Accounts" /media/miracle/
echo "Completd 2012 Accounts Files Sync, Starting 2012 Files Sync"

rsync -rvu /media/hdd2/"2012 Files" /media/miracle/
echo "Completd 2012 Files Sync, Starting 2013 Accounts Files Sync"

rsync -rvu /media/hdd2/"2013 Accounts" /media/miracle/
echo "Completd 2013 Accounts, Starting Admin Files Sync"

rsync -rvu /media/hdd2/"Admin" /media/miracle/
echo "Completd Admin Files Sync, Starting MA_Staff Data File Sync"

rsync -rvu /media/hdd2/MA_Staff /media/miracle/
echo "Completd MA_Staff Data File Sync, Starting MA-Outbound Data File
Sync"

rsync -rvu /media/hdd2/MA_Outbound /media/miracle/
echo "Completd MA-Outbound Data File Sync, Starting Staff Pic Data File Sync"

rsync -rvu /media/hdd2/"Staff Pic" /media/miracle/
echo "Completed Staff Pic Data File Sync, End OF Syn"

but individually... it works fine. This is the command;
30 22 * * * $Home/Desktop/marsync.sh >AutoRsyncLogfile.txt
Please help...
 
Old 09-03-2014, 10:38 AM   #2
thesnow
Member
 
Registered: Nov 2010
Location: Minneapolis, MN
Distribution: Ubuntu, Red Hat, Mint
Posts: 170

Rep: Reputation: 56
What is the error you are seeing?

Does the "$Home" variable have any value assigned to it? You may want to try putting in the full path of the home directory in the cron entry, and also set your PATH explicitly in your script.

Not sure what you mean by "individually...it works fine" - does that mean running the rsync commands directly works, and/or running the script outside of cron works? If the script won't run, check that it has execute permissions.
 
Old 09-03-2014, 07:42 PM   #3
solarisguy
Member
 
Registered: Aug 2010
Location: Seattle
Distribution: CentOS, RHEL, Oracle Enterprise Linux, Solaris, BSD
Posts: 64

Rep: Reputation: 19
Try adding adding /usr/bin to the path, as follows:

Code:
#! /bin/bash
export PATH=$PATH:/usr/bin

echo "Rsync - MA Inbound Files"
rsync -rvu /media/hdd2/MA-Inbound /media/miracle/
echo "Completed MA Inbound Files Sync, Starting Tally.ERP 9 Data File Sync"

rsync -rvu /media/hdd2/Tally.ERP9 /media/miracle/
echo "Completd Tally.ERP9 Data File Sync, Starting 2011 Accounts Files Sync"

rsync -rvu /media/hdd2/"2011 Accounts" /media/miracle/
echo "Completd 2011 Accounts Files Sync, Starting 2012 Accounts Files Sync"

rsync -rvu /media/hdd2/"2012 Accounts" /media/miracle/
echo "Completd 2012 Accounts Files Sync, Starting 2012 Files Sync"

rsync -rvu /media/hdd2/"2012 Files" /media/miracle/
echo "Completd 2012 Files Sync, Starting 2013 Accounts Files Sync"

rsync -rvu /media/hdd2/"2013 Accounts" /media/miracle/
echo "Completd 2013 Accounts, Starting Admin Files Sync"

rsync -rvu /media/hdd2/"Admin" /media/miracle/
echo "Completd Admin Files Sync, Starting MA_Staff Data File Sync"

rsync -rvu /media/hdd2/MA_Staff /media/miracle/
echo "Completd MA_Staff Data File Sync, Starting MA-Outbound Data File
Sync"

rsync -rvu /media/hdd2/MA_Outbound /media/miracle/
echo "Completd MA-Outbound Data File Sync, Starting Staff Pic Data File Sync"

rsync -rvu /media/hdd2/"Staff Pic" /media/miracle/
echo "Completed Staff Pic Data File Sync, End OF Syn"
 
  


Reply

Tags
cronjob, ubuntu 12.04


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
My Cron Job Doesn't Work carlosinfl Linux - Server 8 06-07-2010 10:50 PM
[SOLVED] Can't get any cron job to work! soupnsandwich Linux - Desktop 64 08-01-2009 09:48 AM
Why my cron job doesn't work byng08 Linux - Newbie 7 11-26-2008 02:17 AM
cron job files vikas027 Linux - General 4 11-12-2008 04:42 AM
How do I get a cron job to work? socceroos Linux - Software 2 03-23-2006 05:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:57 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration