Linux Cron Job

I need to issue this command every minute from within /etc/crontab:
echo 3 > /proc/sys/vm/drop_caches

What is the line I need to add to /etc/crontab to make it work?

 * * * * root echo 3 > /proc/sys/vm/drop_caches DOES NOT WORK

and a number of other variants...

true expert needed on this one...
lvnvAsked:
Who is Participating?
 
TintinCommented:
How are you determining it isn't working?
0
 
ValleyENTCommented:
0,1,2,3  *  *  *  *  script
or
*/1  *  *  *  *  script

The format */1 is not supported on all platforms.

The * in the filed means all possible values for that field. Thus for the minutes field it will cover the whole range 0-59.
0
 
TintinCommented:
ValleyENT

* * * *

is the correct/valid format for all Linux/Unix systems.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
omarfaridCommented:
why do you want to create the file in /proc/sys/vm ? I don't think you can create files there ! try to send it to /tmp or some other dir
0
 
SteveNetwork ManagerCommented:
ok.. try adding /bin/echo in front first.. if that dosent work then create a runme.sh script like this :

#!/bin/sh
/bin/echo 3 > > /proc/sys/vm/drop_caches

then add it to your cron script

0-59 * * * * /<location of script>/<scriptname>.sh

that will make it run every minute..

0
 
omarfaridCommented:
I tried to copy / create files under that dir on fedora 8 and it says that I can not create regular file
0
 
lvnvAuthor Commented:
umm...I'm giving you all 125 points to keep quiet...
it was my own fault...Late night dumb error...
crond was stopped...
turned it on and all is good...
thanks for your replies
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.