LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 11-24-2010, 09:19 PM   #1
chaying
LQ Newbie
 
Registered: Sep 2010
Posts: 17

Rep: Reputation: 1
cron.d is ignoring my script


Hi

I got this test script :

Code:
# /etc/cron.d/private: personal admin crontab entries

SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

/1 * * * * root echo 'Succeeded !' | mailx -s "Saving list of installed packages" "admin@localhost"
And cron.d just ignoring it. Does anyone know why ?

rights :
-rw-r--r-- 1 root root 254 24 nov. 20:08 /etc/cron.d/private

Thanks

Last edited by chaying; 11-24-2010 at 09:20 PM.
 
Old 11-24-2010, 10:06 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
I sincerely doubt cron is ignoring it. More likely it's having a problem. As a rule cron will email any issue to root. Try

mailx

from the cmd line as root. Incidentally, that should run every minute, which would be a lot(!) of emails. Definite danger of filling the disk. Not to mention the overhead on the system of creating a new process env every minute.
 
Old 11-25-2010, 12:32 AM   #3
chaying
LQ Newbie
 
Registered: Sep 2010
Posts: 17

Original Poster
Rep: Reputation: 1
Hi thanks to answer

Actually : "no mail for root" is the answer to the cmd.

What you re saying is that cron refuses to treat the "script" because of the danger to fill the disk ?

Anyway it was just a test, for not to wait the answer..
 
Old 11-25-2010, 01:01 AM   #4
tommyttt
Member
 
Registered: Oct 2009
Location: Federal Way, WA
Distribution: openSUSE 11.4 x86_64, openSuSE 12.1, Fedora 15
Posts: 207

Rep: Reputation: 34
Quote:
Originally Posted by chaying View Post
Hi thanks to answer

Actually : "no mail for root" is the answer to the cmd.

What you re saying is that cron refuses to treat the "script" because of the danger to fill the disk ?
No, that is not what he said. You need to research cron/crontab to get the correct syntax. You have it running that script every minute, therefore 60 times per hour which can quickly fill a disk.

What are you trying to accomplish with this script? It appears that all you're doing is sending a "subject" (-s) but not a list of installed programs. Further, you're sending it to "admin@localhost". That is not a valid address unless you have created a separate user account for "admin". The administrative account in linux is called "root" with an address of "root@localhost".

Tom
 
Old 11-25-2010, 02:55 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Code:
/1 * * * * root echo 'Succeeded !'
I don't know if this is a typo, but the time specification is not valid. /1 alone is not allowed, whereas */1 is. Also note that specifying an interval of 1 minute is the same as leaving the asterisk alone. Furthermore, have you checked the system logs? Maybe there is some message from the cron daemon reporting the incorrect syntax of the crontab.
 
Old 11-25-2010, 04:34 AM   #6
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
As tommyttt said, does the user admin exist on your system?
You should use admin, not admin@localhost
Try to run the command from the commandprompt, and see what happens.
Take a look in maillog for any errormessages.

Kind regards
 
Old 11-25-2010, 11:18 PM   #7
chaying
LQ Newbie
 
Registered: Sep 2010
Posts: 17

Original Poster
Rep: Reputation: 1
Thank you to all for showing interest.

And especially to colucix : you were right, I kind of miss that in the doc.

Mea culpa !
 
  


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
cron is ignoring lines... true_atlantis Linux - Software 4 04-09-2009 05:35 AM
Cron appears to be messed up (E: cron: subprocess post-installation script returned e bujutsukai Linux - Newbie 1 07-24-2008 03:39 AM
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
Ignoring Environment Variables when Starting a BASH Script Garnett Linux - Software 3 09-21-2007 01:00 PM

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

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