LinuxQuestions.org
Review your favorite Linux distribution.
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 03-01-2008, 11:53 AM   #1
richinsc
Member
 
Registered: Mar 2007
Location: Utah
Distribution: Ubuntu Linux (20.04)
Posts: 224

Rep: Reputation: 32
Cron Schedule Issue


After editing my crontab to include my backup script a new error has started appearing that i have tried to correct but have so far been unsuccessful. I have for the past two days been receiving the following email every hour. Below is the msg.

Code:
/bin/sh: root: command not found
Here is my crontab. I have check to make sure that there are no extras spaces then is required.

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 )
#

# Backup of County data and system configuration
# m h dom mon dow user  command
00 21   * * *   root    /etc/cron.daily/backup.cron
#
I had to add the line for my backup script directly because cron wouldn't execute it even thought it was included in /etc/cron.daily directory. Any advice would be well appreciated.

Edit: Forgot to add that this error is only for the /etc/cron.hourly line.

Last edited by richinsc; 03-01-2008 at 11:54 AM. Reason: Error
 
Old 03-01-2008, 04:36 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
IIRC you cannot have a dot "." in the command/script you want cron to run. So rename your script to just plain backup and see if it works.

Regards
 
Old 03-01-2008, 04:57 PM   #3
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
I cetrtainly call my scripts .sh, and I run these from cron with a dot in them OK.

Why not just put your backup in root's crontab with crontab -e, but omit the user, ie:


Code:
00 21   * * *   /etc/cron.daily/backup.cron
instead of

Code:
00 21   * * *   root    /etc/cron.daily/backup.cron
 
Old 03-01-2008, 05:32 PM   #4
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
If you are getting this error every hour, what makes you think it is your daily cron?

where is "run-parts"? If sh can't find something, and it is happening every hour, it would seem you might want to look at that.
 
  


Reply

Tags
command, crontab, error, found



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
Schedule a command for twice daily with cron? pdeman2 Linux - Software 7 04-23-2013 05:47 PM
what is cron schedule coldbeerz Linux - Newbie 5 12-05-2007 03:24 PM
LXer: Schedule Tasks Using Gnome-schedule (cron & at GUI) LXer Syndicated Linux News 0 07-28-2007 12:31 AM
How do I schedule a cron job? BillyGalbreath Debian 1 05-18-2006 09:52 PM
Trying to schedule ftp login using cron compuser Linux - General 2 06-10-2005 04:22 AM

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

All times are GMT -5. The time now is 06:54 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