LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-21-2008, 02:57 PM   #1
richinsc
Member
 
Registered: Mar 2007
Location: Utah
Distribution: Ubuntu Linux (20.04)
Posts: 224

Rep: Reputation: 32
Question Backup Script Fails!


I have a backup script that I run and am getting failures and not having backups even show up because script can't connect to share before running script I would like to make it so that the script will connect the share before running the script. To connect all I have to do is
Quote:
cd /cfsscop1
and the share connects... This is done with smbclient to windows share.

After connecting the following appears in /var/log/messages

Code:
Feb 21 09:49:16 dragon -- MARK --
Feb 21 10:09:17 dragon -- MARK --
Feb 21 10:29:17 dragon -- MARK --
Feb 21 10:45:35 dragon kernel: SMB connection re-established (-5)
Feb 21 11:09:17 dragon -- MARK --
Feb 21 11:29:18 dragon -- MARK --
Feb 21 11:49:18 dragon -- MARK --
If I run the script after manually cd to directory then script runs, this script however run in the early morning when I am asleep so I can't cd to the dir before backup starts...

here is script.

Code:
#!/bin/sh
# full and incremental backup script
# created 07 February 2000
# Based on a script by Daniel O'Callaghan <danny@freebsd.org>
# and modified by Gerhard Mourani <gmourani@videotron.ca>

#Change the 5 variables below to fit your computer/backup

COMPUTER=dragon                                 # name of this computer
DIRECTORIES="/home"                             # directoris to backup
BACKUPDIR=/cfsscop1/dragon_backup               # where to store the backups
TIMEDIR=/cfsscop1/dragon_backup/last-full       # where to store time of full backup
TAR=/bin/tar                                    # name and locaction of tar

#You should not have to change anything below here

PATH=/usr/local/bin:/usr/bin:/bin
DOW=`date +%a`                          # Day of the week e.g. Mon
DOM=`date +%d`                          # Date of the Month e.g. 27
DM=`date +%d%b`                 # Date and Month e.g. 27Sep

# On the 1st of the month a permanet full backup is made
# Every Sunday a full backup is made - overwriting last Sundays backup
# The rest of the time an incremental backup is made. Each incremental
# backup overwrites last weeks incremental backup of the same name.
#
# if NEWER = "", then tar backs up all files in the directories
# otherwise it backs up files newer than the NEWER date. NEWER
# gets it date from the file written every Sunday.

# Monthly full backup
if [ $DOM = "01" ]; then
        NEWER=""
        $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DM.tar $DIRECTORIES
fi

# Weekly full backup
if [ $DOW = "Sun" ]; then
        NEWER=""
        NOW=`date +%d-%b`

        # Update full backup date
        echo $NOW > $TIMEDIR/$COMPUTER-full-date
        $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES

# Make incremental backup - overwrite last weeks
else

        # Get date of last full backup
        NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`"
        $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
fi
Backup script taken from http://www.faqs.org/docs/securing/chap29sec306.html

I have tried adding "cd /cfsscop1" to the script but then that causes errors as well since after doing research I found that I can't just put a command like that directly into script. Any help would be much appreciated.
 
Old 02-21-2008, 03:45 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Here's what I don't understand: Why do you have to CD to the share in order to connect?

Is the share in your fstab? Is one machine a laptop that isn't always connected?

Those questions should be answered first, but in the interim, instead of connecting to (or mounting) a share by cd'ing to the share name, you should actually mount the share to connect, so, in the script, "mount /cfsscop1" (assuming it's in your fstab and the script user has permissions to mount, otherwise, you'll need to do the full mount string), do your stuff, then "umount /cfsscop1" (assuming you don't want it always mounted).

*that* said, you should never have to mount in a script unless there's a good reason for doing so.

edited to add: also, this script is tarring up a directory, but it's not compressing it, so you have an uncompressed archive - probably taking up more space that is really needed. Again, unless there's a good reason for doing so, change this line:

$TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DM.tar $DIRECTORIES

to this:

$TAR $NEWER -cfz $BACKUPDIR/$COMPUTER-$DM.tgz $DIRECTORIES

... you'll save a good bit of space on whatever it is you're backing up to. Then, if you ever need to recover the stuff, "tar xvzf $BACKUPDIR/$COMPUTER-$DM.tgz"

Last edited by BrianK; 02-21-2008 at 03:49 PM.
 
Old 02-21-2008, 03:50 PM   #3
richinsc
Member
 
Registered: Mar 2007
Location: Utah
Distribution: Ubuntu Linux (20.04)
Posts: 224

Original Poster
Rep: Reputation: 32
Yes it is in fstab but if no one is connected or using this share the share goes offline or into a sleep mode until someone tries to enter that directory then this connection gets re-established as you see in /var/log/messages... It woudld be great if I could figure out how to keep it connected so that I wouldn't have to re-establish the share prior to backup starting. I think I found a way using /bin/ls in script that will at least run a command on the directory so that the connection is re-established prior to the script running backup.

Below is fstab

Code:
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/hda2       /               ext3    defaults,errors=remount-ro 0       1
/dev/hda1       none            swap    sw              0       0
/dev/hdc        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
//10.4.12.50/FTP /mnt/cfsscop1 smbfs rw,credentials=/etc/samba/cred-file,uid=richinsc,gid=users,fmask=0770,dmask=0770 0 0
 
Old 02-27-2008, 03:02 PM   #4
richinsc
Member
 
Registered: Mar 2007
Location: Utah
Distribution: Ubuntu Linux (20.04)
Posts: 224

Original Poster
Rep: Reputation: 32
Backup script still fails to run on schedule have monitored it for the past week and have had to manually execute script. Could someone please advise and ask questions and I will answer then and together we can figure out this issue.
 
Old 02-27-2008, 03:12 PM   #5
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Rishinsc, canyou please outline exactly what your problem is here. What isn't running, how are you running it, what are you seeing?

If you are running from cron, either give your cron entry or the message that is being sent to the cron user after it runs, etc, etc.

If yo ucan't see what's happening early in the morning, change the cron time or whatever to 5 minutes in the future and watch it then.

We really need a lot more info than you are giving - read through your posts and see if you can follow what is going on.




Cheers
 
Old 02-27-2008, 03:44 PM   #6
richinsc
Member
 
Registered: Mar 2007
Location: Utah
Distribution: Ubuntu Linux (20.04)
Posts: 224

Original Poster
Rep: Reputation: 32
I am running a cron script that is above and outlined in first post and code box 3. This script is supposed to run every morning at 6:25am from the /etc/cron.daily location. When I come in the morning my backup hasn't ran and I don't see the newest file backed up. I then have to issue command /etc/cron.daily/backup.cron and then the script excutes and works correctly... Below is my cronttab.

Code:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=myemail@domain.com

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
Here are the permissions for the scripts in /etc/cron.daily, Please note that all the other scripts work just find and execute correctly at scheduled time but this script does not...

Code:
 ls -la /etc/cron.daily/
total 72
drwxr-xr-x  2 root root 4096 2008-02-23 12:42 .
drwxr-xr-x 56 root root 4096 2008-02-02 15:43 ..
-rwxr-xr-x  1 root root 5041 2007-02-26 16:21 apt
-rwxr-xr-x  1 root root  314 2007-03-14 10:11 aptitude
-rwxr-xr-x  1 root root 1968 2008-02-21 22:58 backup.cron
-rwxr-xr-x  1 root root  502 2007-01-02 12:26 bsdmainutils
-rwxr-xr-x  1 root root  527 2006-11-11 04:47 exim
-rwxr-xr-x  1 root root 3961 2007-01-20 04:46 exim4-base
-rwxr-xr-x  1 root root  419 2006-08-06 04:12 find
-rwxr-xr-x  1 root root   89 2006-04-08 18:16 logrotate
-rwxr-xr-x  1 root root  133 2006-12-04 17:36 logwatch
-rwxr-xr-x  1 root root  946 2007-01-29 07:20 man-db
-rw-r--r--  1 root root  102 2006-12-19 19:02 .placeholder
-rwxr-xr-x  1 root root  201 2008-02-23 12:17 rkhunter
-rwxr-xr-x  1 root root  383 2007-05-30 05:53 samba
-rwxr-xr-x  1 root root 3283 2006-12-19 19:02 standard
-rwxr-xr-x  1 root root 1307 2006-05-25 05:38 sysklogd
I get no error messages from this in email of crontab... So I am unsure what is causing issue... Now the backups are being stored on a windows file share that is being mounted via smbfs in fstab posted above in post 2 code box 1. At first I thought it was an issue with the script not connecting to share but after watching for past few days I am wondering if cron is even executing script... It is also intresting to note that syslog is restarting at 6:28 and

Here are results from syslog

Code:
Feb 27 06:28:18 dragon syslogd 1.4.1#18: restart.
Feb 27 06:38:01 dragon /USR/SBIN/CRON[6008]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 06:51:00 dragon -- MARK --
Feb 27 06:53:01 dragon /USR/SBIN/CRON[6011]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 07:02:01 dragon /USR/SBIN/CRON[6013]: (logcheck) CMD (   if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi)
Feb 27 07:08:01 dragon /USR/SBIN/CRON[6856]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 07:17:01 dragon /USR/SBIN/CRON[6858]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 27 07:23:01 dragon /USR/SBIN/CRON[6862]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 07:38:01 dragon /USR/SBIN/CRON[6864]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 07:51:00 dragon -- MARK --
Feb 27 07:53:01 dragon /USR/SBIN/CRON[6867]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 08:02:01 dragon /USR/SBIN/CRON[6869]: (logcheck) CMD (   if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi)
Feb 27 08:08:01 dragon /USR/SBIN/CRON[7665]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 08:17:01 dragon /USR/SBIN/CRON[7667]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 27 08:23:01 dragon /USR/SBIN/CRON[7671]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 08:38:01 dragon /USR/SBIN/CRON[7673]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 08:51:01 dragon -- MARK --
Feb 27 08:53:01 dragon /USR/SBIN/CRON[7676]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 09:02:01 dragon /USR/SBIN/CRON[7679]: (logcheck) CMD (   if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi)
Feb 27 09:05:35 dragon kernel: SMB connection re-established (-5)
Feb 27 09:08:01 dragon /USR/SBIN/CRON[8504]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 09:17:01 dragon /USR/SBIN/CRON[8509]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 27 09:23:01 dragon /USR/SBIN/CRON[8513]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 09:38:01 dragon /USR/SBIN/CRON[8515]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 09:51:02 dragon -- MARK --
Feb 27 09:53:01 dragon /USR/SBIN/CRON[8538]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 10:02:01 dragon /USR/SBIN/CRON[8540]: (logcheck) CMD (   if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi)
Feb 27 10:08:01 dragon /USR/SBIN/CRON[9506]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 10:17:01 dragon /USR/SBIN/CRON[9521]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 27 10:23:01 dragon /USR/SBIN/CRON[9525]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 10:38:01 dragon /USR/SBIN/CRON[9527]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 10:51:03 dragon -- MARK --
Feb 27 10:53:01 dragon /USR/SBIN/CRON[9533]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 11:02:01 dragon /USR/SBIN/CRON[9535]: (logcheck) CMD (   if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi)
Feb 27 11:08:01 dragon /USR/SBIN/CRON[10344]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 11:17:01 dragon /USR/SBIN/CRON[10346]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 27 11:23:01 dragon /USR/SBIN/CRON[10350]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 11:38:01 dragon /USR/SBIN/CRON[10352]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 11:51:03 dragon -- MARK --
Feb 27 11:53:01 dragon /USR/SBIN/CRON[10355]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 12:02:01 dragon /USR/SBIN/CRON[10357]: (logcheck) CMD (   if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi)
Feb 27 12:08:01 dragon /USR/SBIN/CRON[11153]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 12:17:01 dragon /USR/SBIN/CRON[11155]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 27 12:23:01 dragon /USR/SBIN/CRON[11160]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 12:38:01 dragon /USR/SBIN/CRON[11163]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 12:51:04 dragon -- MARK --
Feb 27 12:53:01 dragon /USR/SBIN/CRON[11166]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 13:02:01 dragon /USR/SBIN/CRON[11168]: (logcheck) CMD (   if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi)
Feb 27 13:08:01 dragon /USR/SBIN/CRON[11996]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 13:17:01 dragon /USR/SBIN/CRON[11998]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 27 13:23:01 dragon /USR/SBIN/CRON[12002]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 13:38:01 dragon /USR/SBIN/CRON[12004]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 13:51:05 dragon -- MARK --
Feb 27 13:53:01 dragon /USR/SBIN/CRON[12007]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 14:02:01 dragon /USR/SBIN/CRON[12009]: (logcheck) CMD (   if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi)
Feb 27 14:08:01 dragon /USR/SBIN/CRON[12805]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 14:17:01 dragon /USR/SBIN/CRON[12809]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 27 14:23:01 dragon /USR/SBIN/CRON[12813]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 14:38:01 dragon /USR/SBIN/CRON[12815]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 14:51:05 dragon -- MARK --
Feb 27 14:53:01 dragon /USR/SBIN/CRON[12818]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 15:02:01 dragon /USR/SBIN/CRON[12820]: (logcheck) CMD (   if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi)
Feb 27 15:08:01 dragon /USR/SBIN/CRON[13616]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 15:17:01 dragon /USR/SBIN/CRON[13618]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 27 15:23:01 dragon /USR/SBIN/CRON[13622]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 15:38:01 dragon /USR/SBIN/CRON[13624]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 15:51:06 dragon -- MARK --
Feb 27 15:53:02 dragon /USR/SBIN/CRON[13627]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 16:02:01 dragon /USR/SBIN/CRON[13629]: (logcheck) CMD (   if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi)
Feb 27 16:08:01 dragon /USR/SBIN/CRON[14425]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 16:17:01 dragon /USR/SBIN/CRON[14427]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 27 16:23:01 dragon /USR/SBIN/CRON[14431]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Result from syslog.0 prior to restart

Code:
Feb 27 05:23:01 dragon /USR/SBIN/CRON[10507]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 05:38:01 dragon /USR/SBIN/CRON[10509]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 05:50:59 dragon -- MARK --
Feb 27 05:53:01 dragon /USR/SBIN/CRON[10512]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 06:02:01 dragon /USR/SBIN/CRON[10514]: (logcheck) CMD (   if [ -x /usr/sbin/logcheck ]; then nice -n10 /usr/sbin/logcheck; fi)
Feb 27 06:08:01 dragon /USR/SBIN/CRON[11310]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 06:13:01 dragon /USR/SBIN/CRON[11312]: (mail) CMD (if [ -x /usr/sbin/exim_tidydb ]; then /usr/sbin/exim_tidydb /var/spool/exim retry >/dev/null; fi)
Feb 27 06:17:01 dragon /USR/SBIN/CRON[11315]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Feb 27 06:17:01 dragon /USR/SBIN/CRON[11317]: (mail) CMD (if [ -x /usr/sbin/exim_tidydb ]; then /usr/sbin/exim_tidydb /var/spool/exim wait-remote_smtp >/dev/null; fi)
Feb 27 06:23:01 dragon /USR/SBIN/CRON[11322]: (mail) CMD (  if [ -x /usr/lib/exim/exim3 -a -f /etc/exim/exim.conf ]; then /usr/lib/exim/exim3 -q ; fi)
Feb 27 06:25:01 dragon /USR/SBIN/CRON[11324]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
Feb 27 06:25:02 dragon kernel: SMB connection re-established (-5)
You can see smb connection being established but that is about it... Please let me know what else I can give you I will re-look over past posts.
 
Old 02-27-2008, 04:31 PM   #7
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
WHy don't you try taking the script out of cron.daily and run it from root's crontab instead and see how that goes. That will potentially isolate the issue, and hopefully root wll get a more detailed report emailed to it.

I take it you restarted crond since you added the file to /etc/cron.daily?
 
Old 02-27-2008, 05:37 PM   #8
richinsc
Member
 
Registered: Mar 2007
Location: Utah
Distribution: Ubuntu Linux (20.04)
Posts: 224

Original Poster
Rep: Reputation: 32
No I did not I will try that we'll see what happens cause the file that I put in root's home dir did not execute automatically either...

Let me restart crond and see what happens.
 
Old 02-27-2008, 05:55 PM   #9
richinsc
Member
 
Registered: Mar 2007
Location: Utah
Distribution: Ubuntu Linux (20.04)
Posts: 224

Original Poster
Rep: Reputation: 32
After restarting script, schedule still fails to execute at time told and specified in cron... but if I run script directly rather then having script run by schedule of /etc/cron.daily it works.. What I mean is if I put following in crontab it works

Code:
47 18   * * *   root    /root/scripts/backup.cron
But if I put script in /etc/cron.daily and have the the following in cron

Code:
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
Everything except my backup script executes from /etc/cron.daily
 
Old 02-28-2008, 10:52 AM   #10
p_s_shah
Member
 
Registered: Mar 2005
Location: India
Distribution: RHEL 3/4, Solaris 8/9/10, Fedora 4/8, Redhat Linux 9
Posts: 237
Blog Entries: 1

Rep: Reputation: 34
Autofs ???

Are you using Autofs ?

Because in case of Autofs, File systems are mounted as needed, and disconnected when not accessed for specific time.

Please check /etc/auto.master, /etc/auto.* files.

Regards,
 
Old 02-28-2008, 11:51 AM   #11
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
I also say to use autofs. It will simplify your life. And if that still doesn't work out and the script fails cause it's waiting for the remote mount/share, then plug a sleep command in there. And from what you described, putting this in root's cron won't make a difference.


cd /$BACKUPDIR
sleep 60

<-- rest of script here -->

Really shouldn't be that hard to work around. Then again, why is this remote share going into a sleep mode? You can always make it so this remote computer/server doesn't sleep since it's got shares that need to be accessible.

Last edited by trickykid; 02-28-2008 at 11:52 AM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Webmin simple backup fails Tenover Linux - Software 3 12-16-2005 11:32 AM
Backup fails on specific files tcamp Linux - General 3 12-19-2004 05:56 AM
help with backup script dennis_89 Linux - Networking 2 06-29-2004 09:47 AM
Yast2 Backup Fails Consistently wmeler Linux - General 0 06-18-2004 04:10 PM
backup script lhoff Programming 2 05-28-2003 11:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:10 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
Open Source Consulting | Domain Registration