Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all, I'm new to this forum, and fairly new to linux. Most of what I have learned has been through googling and trial and error. I have almost sorted ...
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    2

    crontab script running but not running

    Hi all, I'm new to this forum, and fairly new to linux. Most of what I have learned has been through googling and trial and error. I have almost sorted my western digital NAS for the uses I need, but there is an ftp mirror problem that I can't fathom.

    I have three working copies of three svn repositories on my WD NAS. The script below updates these working copies successfully, then the next command mirrors the working copies onto a local FTP server stored on a Buffalo Linkstation. Both things work well when run manually.

    The problem is that the script runs at 4am every day via a crontab file, (I know this because the date and the 'FTP complete' string appear in the log file), but the actual updates and the mirror commands don't seem to run. The WD NAS has been put together by me from SSH access, and my PATH string is also below.

    My lack of scripting experience is likely the cause here, so I could really do with a hand with this one. Googling this problem yields problems with getting crontab commands to run, I've yet to see this problem.

    Regards,
    Mike

    Code:
    # Start by logging the current date/time in the main log
    date >> /shares/internal/PUBLIC/logs/svnftpupdatelog.main
    
    #Run svn update for each repository and record the current revision number in the main log
    cd /shares/internal/PUBLIC/VSOE
    /opt/bin/svn update >> /shares/internal/PUBLIC/logs/svnftpupdatelog.main
    cd /shares/internal/PUBLIC/VRPL
    /opt/bin/svn update >> /shares/internal/PUBLIC/logs/svnftpupdatelog.main
    cd /shares/internal/PUBLIC/QMS
    /opt/bin/svn update  >> /shares/internal/PUBLIC/logs/svnftpupdatelog.main
    
    #Run the FTP client and mirror current working copies to the FTP server (individual logs created)
    /opt/bin/lftp -f /etc/svnftpupdate.ftp -u david,railways 192.168.2.5
    
    #Log completion of FTP backup in the main log
    echo FTP Complete >> /shares/internal/PUBLIC/logs/svnftpupdatelog.main
    date >> /shares/internal/PUBLIC/logs/svnftpupdatelog.main
    
    #Append cumulative FTP transaction logs for each repository
    date >> /shares/internal/PUBLIC/logs/svnftpupdatelog.vsoe.cumulative
    cat /shares/internal/PUBLIC/logs/svnftpupdatelog.vsoe >> /shares/internal/PUBLIC/logs/svnftpupdatelog.vsoe.cumulative
    date >> /shares/internal/PUBLIC/logs/svnftpupdatelog.vrpl.cumulative
    cat /shares/internal/PUBLIC/logs/svnftpupdatelog.vrpl >> /shares/internal/PUBLIC/logs/svnftpupdatelog.vrpl.cumulative
    date >> /shares/internal/PUBLIC/logs/svnftpupdatelog.qms.cumulative
    cat /shares/internal/PUBLIC/logs/svnftpupdatelog.qms >> /shares/internal/PUBLIC/logs/svnftpupdatelog.qms.cumulative
    Path:
    Code:
    /bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/bin

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Please show us a copy of your crontab file.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Apr 2009
    Posts
    2
    Here it is, I had some problem getting it working to start with, when running /opt/etc/crontab I get permission denied. When running /opt/bin/crontab -l I get a crontab file with nothing in it. When viewing the file /etc/crontabs/root I have got:

    Code:
    # standard crontab format for busybox cron daemon.
    # fields may be lists
    # min    hour day month wd  command
    #  *      *    *   *     *   dosomething
    
    PATH=$PATH:/etc:/opt/bin
    MAILTO=root
    
    # save the date every day at midnight
    0   0    *   *     *   date +%m%d%H%M%Y.%S > /var/lib/now
    0   4    *   *     *   sh /etc/svnftpupdate
    And as I say, the script /etc/svnftpupdate is running at 4am everyday, but the programs aren't running (it is possible that the ftp command is working and the svn updates only are the problem).

    Thanks in advance!
    Mike

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Read the man page for crontab. The -u option might be relevant to you, as may be /etc/cron.allow and /etc/cron.deny. The page from CentOS 5.3 (RHEL 5.3) follows:
    Code:
    CRONTAB(1)                                                          CRONTAB(1)
    
    NAME
           crontab - maintain crontab files for individual users (ISC Cron V4.1)
    
    SYNOPSIS
           crontab [-u user] file
           crontab [-u user] [-l | -r | -e] [-i] [-s]
    
    DESCRIPTION
           Crontab  is the program used to install, deinstall or list the tables used to
           drive the cron(8) daemon in ISC Cron.  Each user can have their own  crontab,
           and  though  these  are  files  in  /var/spool/ , they are not intended to be
           edited directly. For SELinux in mls mode can be even more crontabs - for each
           range. For more see selinux(8).
    
           If the cron.allow file exists, then you must be listed therein in order to be
           allowed to use this command.  If the cron.allow file does not exist  but  the
           cron.deny  file does exist, then you must not be listed in the cron.deny file
           in order to use this command.  If neither of these  files  exists,  only  the
           super user will be allowed to use this command.
    
    OPTIONS
           -u     It  specifies the name of the user whose crontab is to be tweaked.  If
                  this option is not given, crontab examines "your" crontab,  i.e.,  the
                  crontab of the person executing the command.  Note that su(8) can con-
                  fuse crontab and that if you are running inside of  su(8)  you  should
                  always  use  the  -u option for safety’s sake.  The first form of this
                  command is used to install a new crontab from some named file or stan-
                  dard input if the pseudo-filename "-" is given.
    
           -l     The current crontab will be displayed on standard output.
    
           -r     The current crontab will be be removed.
    
           -e     This option is used to edit the current crontab using the editor spec-
                  ified by the VISUAL or EDITOR environment variables.  After  you  exit
                  from the editor, the modified crontab will be installed automatically.
    
           -i     This option modifies the -r option to prompt  the  user  for  a  ’y/Y’
                  response before actually removing the crontab.
    
           -s     It  will  append  the  current  SELinux  security context string as an
                  MLS_LEVEL setting to the crontab file  before  editing  /  replacement
                  occurs - see the documentation of MLS_LEVEL in crontab(5).
    
    SEE ALSO
           crontab(5), cron(8)
    
    FILES
           /etc/cron.allow
           /etc/cron.deny
    
    STANDARDS
           The  crontab  command  conforms to IEEE Std1003.2-1992 (‘‘POSIX’’).  This new
           command syntax differs from previous versions of Vixie Cron, as well as  from
           the classic SVR3 syntax.
    
    DIAGNOSTICS
           A  fairly  informative usage message appears if you run it with a bad command
           line.
    
    AUTHOR
           Paul Vixie <vixie@isc.org>
    
    4th Berkeley Distribution       16 Januar 2007                      CRONTAB(1)
    Note that the cron files are in /var/spool/.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...