Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Technical

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 27th May 2013, 10:39
Frankly3D Frankly3D is offline
Junior Member
 
Join Date: Dec 2006
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Default crontab -e syntax errors

In the terminal :# /bin/repoquery --queryformat %{name} --installed -a
/lists/64/"$(hostname -s).list"

works.


Keep getting syntax errors running it as a cronjob :
crontab -e
/bin/repoquery --queryformat %{name} --installed -a
/lists/64/"$(hostname -s).list"

Have tried different syntax,' " around name, = to name,
prepend /bin/bash, append exit
Still errors,
__________________
frankly3d.com
"Still Learning"
Reply With Quote
Sponsored Links
  #2  
Old 29th May 2013, 00:32
monkfish monkfish is offline
HowtoForge Supporter
 
Join Date: Mar 2013
Posts: 106
Thanks: 9
Thanked 15 Times in 14 Posts
Default

Think you might have to specify timings... there are 5 fields that go before the command set you want to run in cron, defined as minute,hour,day,month,day of week...

eg

run every minute
Code:
* * * * * /usr/local/ispconfig/server/server.sh
run every 5 minutes:
Code:
*/5 * * * * /usr/local/ispconfig/server/server.sh
run at 5 minutes past the hour every hour:
Code:
5 * * * * /usr/local/ispconfig/server/server.sh
Also is your script supposed to be piping output to file in /lists/64 - what shows up on my screen in your original post doesn't look quite right?

This works:

Code:
repoquery --queryformat %{name} --installed -a > /lists/64/"$(hostname -s).list"
How often you want to run this? You could of course put your script into /etc/cron.daily and be done with it!
Reply With Quote
  #3  
Old 29th May 2013, 10:37
Frankly3D Frankly3D is offline
Junior Member
 
Join Date: Dec 2006
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by monkfish View Post
Think you might have to specify timings... there are 5 fields that go before the command set you want to run in cron, defined as minute,hour,day,month,day of week...


This works:

Code:
repoquery --queryformat %{name} --installed -a > /lists/64/"$(hostname -s).list"
This is what I had, just dodgy c&p, along with the hourly run.

Here's the error was getting in logwatch:
Usage: repoquery [options]
repoquery: error: --queryformat option requires an argument
Quote:
Originally Posted by monkfish View Post
How often you want to run this? You could of course put your script into /etc/cron.daily and be done with it!
If I get it working I would, any gotchas for cron.hourly
__________________
frankly3d.com
"Still Learning"
Reply With Quote
  #4  
Old 29th May 2013, 10:47
monkfish monkfish is offline
HowtoForge Supporter
 
Join Date: Mar 2013
Posts: 106
Thanks: 9
Thanked 15 Times in 14 Posts
Default

Put this in a script file, eg checkrepo.sh

Code:
#!/bin/sh
repoquery --queryformat %{name} --installed -a > /lists/64/"$(hostname -s).list"
Don't forget to chmod +x after you save it.

Run it, does it produce the results? Seems to on mine. HTH.
Reply With Quote
The Following User Says Thank You to monkfish For This Useful Post:
Frankly3D (29th May 2013)
  #5  
Old 29th May 2013, 11:17
Frankly3D Frankly3D is offline
Junior Member
 
Join Date: Dec 2006
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
 
Default

Quote:
Originally Posted by monkfish View Post
Put this in a script file, eg checkrepo.sh

Code:
#!/bin/sh
repoquery --queryformat %{name} --installed -a > /lists/64/"$(hostname -s).list"
Don't forget to chmod +x after you save it.

Run it, does it produce the results? Seems to on mine. HTH.
Just tested it, as a cron hourly:
# > /var/log/cron
# run-parts /etc/cron.hourly
# cat /var/log/cron
May 29 10:11:33 frank01 run-parts(/etc/cron.hourly)[21072]: starting 0anacron
May 29 10:11:33 frank01 run-parts(/etc/cron.hourly)[21081]: finished 0anacron
May 29 10:11:33 frank01 run-parts(/etc/cron.hourly)[21072]: starting checkrepo.sh
May 29 10:11:35 frank01 run-parts(/etc/cron.hourly)[21089]: finished checkrepo.sh
May 29 10:11:35 frank01 run-parts(/etc/cron.hourly)[21072]: starting mcelog.cron
May 29 10:11:35 frank01 run-parts(/etc/cron.hourly)[21095]: finished mcelog.cron

It seems to run without hitch, thank you.
__________________
frankly3d.com
"Still Learning"
Reply With Quote
Reply

Bookmarks

Tags
cron jobs problem, fedora 18

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unexplained Load increases ZeroEnna Technical 7 3rd December 2011 15:08
Fedora 10 - Virtual Users And Domains With Postfix, Courier etc j.smith1981 Server Operation 6 17th February 2010 01:01
Frustrated with ISPConfig install! woozyerdaddee Installation/Configuration 4 19th May 2006 03:38
Installation Fails... :( cyberstorm Installation/Configuration 1 15th January 2006 18:07
Install stop at uuwish, UUDeview SeaWolf Installation/Configuration 6 4th October 2005 23:53


All times are GMT +2. The time now is 04:04.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.