Re: Checking cronjob syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2012-08-27 08:39, Frank Murphy wrote:
> Today being Monday:
> 45 5 22-28 * * test 'date +\%A' = Sunday && yum -v clean plugins
> 
> Nothing appears to have happened. (no email to root, usual cron stuff)
> So taking the bit from "test" eg:
> test 'date +\%A' = Sunday && blkid (all days in turn)
> blkid doesn't run
> 
> Where have I slipped up
> 
> 

You're using the wrong quotes.  As it stands, your comparing the string
"date +%A" with the string "Sunday".  Presumably what you want is to
compare the output of the command "date +%S" with the string "Sunday".
You need to use "backticks" for that:
test `date +\%A` = Sunday
You're not getting output because the test fails and so yum never gets
executed.  All of that happens in silence, hence no mail to root.
You can check you cron log /var/log/cron to see that the command did
execute.

-- 
Sjoerd Mullender

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux