Results 1 to 4 of 4
hi
i put a simple script to clear cache according to a guide here :
found in hosting dot com site :
Connect via shell using a program such as ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-31-2012 #1Just Joined!
- Join Date
- Mar 2010
- Posts
- 7
Permission problem
hi
i put a simple script to clear cache according to a guide here :
found in hosting dot com site :
Connect via shell using a program such as Putty
At the shell prompt type crontab -e <enter> as this will allow you to edit cron jobs for the root user.
If you are not familiar with vi (linux editor) you press "i" to insert text and once done hit "esc" and type ":wq" to save the file.
Scroll to the bottom of the cron file using the arrows key and enter the following line:
0 * * * * /root/clearcache.sh
Create a file in '/root' called 'clearcache.sh' with the following content:
#!/bin/sh
sync; echo 3 > /proc/sys/vm/drop_caches
Once you have saved this file, the job is complete!
but i get as result :
/bin/sh: /root/clearcache.sh: Permission denied
please advice how to overcome this Permission problem
thanks
- 10-31-2012 #2Linux Enthusiast
- Join Date
- Apr 2004
- Location
- UK
- Posts
- 678
Hi there,
There seems to be a problem with your links (I think they are forbidden until you've made a certain number of posts as an anti-spam measure) but I think we can solve this without them.
If you run:
The bit you are interested is the permissions set at the start of the line. Here root can read and write the file, and group and others can only read the file. If I try to execute it I will get the same permission denied error because the execute bit is not set. If this matches what you see then run the following:Code:# ls -l /root/clearcache.sh -rw-r--r-- 1 root root 0 2012-10-31 23:04 /root/clearcache.sh
You can see the execute bit is now set and you ought to be able to run the script.Code:# chmod u+x /root/clearcache.sh # ls -l /root/clearcache.sh -rwxr--r-- 1 root root 0 2012-10-31 23:04 /root/clearcache.sh
Let us know how you get on.To be good, you must first be bad. "Newbie" is a rank, not a slight.
- 11-01-2012 #3Just Joined!
- Join Date
- Mar 2010
- Posts
- 7
- 11-01-2012 #4Linux Enthusiast
- Join Date
- Apr 2004
- Location
- UK
- Posts
- 678
Hi there,
I don't know what you are using your server for so I can't give you a definite answer. If you don't have a good reason for doing it, then probably not. If clearing the cache every hour was generally a good idea then the default set up would do it for you. On the other hand, there must be some cases where clearing the cache is a good thing or the option wouldn't be available. It really boils down to what your server is going to be doing.
If the article you linked to isn't explaining why you should or shouldn't do something then I would recommend leaving it alone and doing more research and asking questions until you are sure what's going on and that it's the right thing to do.
Let us know how you get on.To be good, you must first be bad. "Newbie" is a rank, not a slight.


Reply With Quote

