/tmp fills up?
Posted by DarkKlown
/tmp fills up? October 04, 2006 03:50AM |
Registered: 18 years ago Posts: 32 |
Hey,
I've only been running phorum for a short time but i just noticed that tmp files that get created in /tmp sometimes dont get cleaned up. So I'm noticing alot of smallish files being created. Do i have something misconfigured or should i just write a small shell script to cleanup any files older than a few hours?
I've only been running phorum for a short time but i just noticed that tmp files that get created in /tmp sometimes dont get cleaned up. So I'm noticing alot of smallish files being created. Do i have something misconfigured or should i just write a small shell script to cleanup any files older than a few hours?
Re: /tmp fills up? October 04, 2006 05:13AM |
Admin Registered: 20 years ago Posts: 8,532 |
This is normal and it is perfectly safe for you to write a script that deletes old files. Deleting the tpl-* files is not neccessary. These hold the compiled versions of the template files. If you do delete them nonetheless, they will be rebuilt by Phorum, only some users might experience broken pages if you are deleting compiled templates the moment that you are deleting them, so it's better not do to so.
Maybe the script that I use for cleaning the cache is useful for you. Here it is:
Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Maybe the script that I use for cleaning the cache is useful for you. Here it is:
#!/bin/sh WWWUSER=w3gitaar CACHE=/tmp TMP=$CACHE/clean.cache.files.$$ PATH=/bin:/usr/bin export PATH find $CACHE -depth -user $WWWUSER -mtime +2 \ | grep -v rewrite_rules \ | grep -v tpl- \ > $TMP for ENTRY in `cat $TMP`; do if [ -d $ENTRY ]; then rmdir --ignore-fail-on-non-empty $ENTRY else rm $ENTRY fi done rm $TMPThe rewrite_rules file is kept intact for the Real Name module, which writes that file. If your system does not know the --ignore-fail-on-non-empty option for rmdir, you might have to lookup the correct flag for suppressing error output about directories not being empty. If no such flag is available (which I doubt), then you could also use something like this:
rmdir $ENTRY 2>&1 | cat > /dev/null
Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: /tmp fills up? October 04, 2006 12:26PM |
Admin Registered: 23 years ago Posts: 4,495 |
RedHat and Gentoo have a package called tmpwatch that can clean up your /tmp dir for you.
Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: /tmp fills up? November 07, 2006 02:41AM |
Registered: 20 years ago Posts: 40 |
Sorry for my ignorance of bash syntax. Does this "TMP=$CACHE/clean.cache.files.$$"
-in the script above- has to be changed in some way to meet my own environment ? What "clean.cache.files" means ? It is important for me to correctly define which part of /tmp is cleaned beacause tmp dir is also used by other porgrams. Thanks for any help.
-in the script above- has to be changed in some way to meet my own environment ? What "clean.cache.files" means ? It is important for me to correctly define which part of /tmp is cleaned beacause tmp dir is also used by other porgrams. Thanks for any help.
Re: /tmp fills up? November 07, 2006 03:31AM |
Admin Registered: 20 years ago Posts: 8,532 |
You do not have to modify that at all. It's just a temp file which is used to write a list of files to delete to. It says:
Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
TMP= set variable $TMP $CACHE start with the value in the variable $CACHE /clean.cache.files. add the string "/clean.cache.files." to it $$ add the process id of the current processSo after running this, the variable $TMP might contain something like /your/cache/dir/clean.cache.files.12345.
Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: /tmp fills up? November 07, 2006 06:13PM |
Registered: 20 years ago Posts: 40 |
Well I put:
WWWUSER=apache (who is the owner of the tmp files and dirs)
CACHE=/tmp/58c4...etc...9c68f
Then I saved the shell in a file that I named "cache_cleaning.sh" in phorum/scripts folder (perhaps it's not the best place but the easiest to remeber where it is)
and then I put it in my crontab so it could execute itshelf every hour
But this does not work and when I call the script directly like
/home/.../www/html/myphorum/scripts/cache_cleaning.sh
I get this error
: bad interpreter: No such file or directory myforum/scripts/cache_cleaning.sh: /bin/sh
and when I look at /bin/sh it exists in its place
Any idea on what I'm doing wrong ?
WWWUSER=apache (who is the owner of the tmp files and dirs)
CACHE=/tmp/58c4...etc...9c68f
Then I saved the shell in a file that I named "cache_cleaning.sh" in phorum/scripts folder (perhaps it's not the best place but the easiest to remeber where it is)
and then I put it in my crontab so it could execute itshelf every hour
But this does not work and when I call the script directly like
/home/.../www/html/myphorum/scripts/cache_cleaning.sh
I get this error
: bad interpreter: No such file or directory myforum/scripts/cache_cleaning.sh: /bin/sh
and when I look at /bin/sh it exists in its place
Any idea on what I'm doing wrong ?
Re: /tmp fills up? November 08, 2006 03:18AM |
Admin Registered: 20 years ago Posts: 8,532 |
Maybe you uploaded the file using binary FTP transfer to the server, adding an invisible character at the end of /bin/sh. I see no other explanation for this.
Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: /tmp fills up? November 08, 2006 03:42AM |
Admin Registered: 22 years ago Posts: 9,240 |
Re: /tmp fills up? November 08, 2006 12:47PM |
Registered: 20 years ago Posts: 40 |
to ts77: non, /bin/sh is present in its place;
to mmakaay: i uploaded the file as text file then run a chmod +x to make it executable, I also made a new file with the notepad to be sure no invalid characters are inside, but I still have : bad interpreter: No such file or directory myforum/scripts/cache_cleaning.sh: /bin/sh
Then I made a new file named test and placed it just under ther root "/" but nothing happens. I changed the --ignore-fail-on-non-empty to --verbose hoping to get some feedback from the machine, but everything is silent. This time I don't have the message above, but nothing happens not even a processing output. It is despairing.
Edited 1 time(s). Last edit at 11/09/2006 05:54PM by milos.
to mmakaay: i uploaded the file as text file then run a chmod +x to make it executable, I also made a new file with the notepad to be sure no invalid characters are inside, but I still have : bad interpreter: No such file or directory myforum/scripts/cache_cleaning.sh: /bin/sh
Then I made a new file named test and placed it just under ther root "/" but nothing happens. I changed the --ignore-fail-on-non-empty to --verbose hoping to get some feedback from the machine, but everything is silent. This time I don't have the message above, but nothing happens not even a processing output. It is despairing.
Edited 1 time(s). Last edit at 11/09/2006 05:54PM by milos.
Re: /tmp fills up? November 12, 2006 03:51PM |
Registered: 18 years ago Posts: 99 |
Hello Maurice,
I tried your script and modified the CASH variable as such:
CACHE=/tmp/c9201e61e1a9a3d73c1d97db98ebb87b/mod_spamhurdles
Which is the link to all those extra directories created by SPAMHURDLE.
I loeade the script in my home directories, chod it to an executable 455 adn trid to call it via telnet.
I got these error messages :
/usr/home/yjulien/clean.cash: cannot create /tmp/c9201e61e1a9a3d73c1d97db98ebb87
b/mod_spamhurdles/clean.cache.files.42477: permission denied
cat: /tmp/c9201e61e1a9a3d73c1d97db98ebb87b/mod_spamhurdles/clean.cache.files.424
77: No such file or directory
rm: /tmp/c9201e61e1a9a3d73c1d97db98ebb87b/mod_spamhurdles/clean.cache.files.4247
7: No such file or directory
Is it because the script tries to delete files while it is directories only?
Thanks,
Yves
I tried your script and modified the CASH variable as such:
CACHE=/tmp/c9201e61e1a9a3d73c1d97db98ebb87b/mod_spamhurdles
Which is the link to all those extra directories created by SPAMHURDLE.
I loeade the script in my home directories, chod it to an executable 455 adn trid to call it via telnet.
I got these error messages :
/usr/home/yjulien/clean.cash: cannot create /tmp/c9201e61e1a9a3d73c1d97db98ebb87
b/mod_spamhurdles/clean.cache.files.42477: permission denied
cat: /tmp/c9201e61e1a9a3d73c1d97db98ebb87b/mod_spamhurdles/clean.cache.files.424
77: No such file or directory
rm: /tmp/c9201e61e1a9a3d73c1d97db98ebb87b/mod_spamhurdles/clean.cache.files.4247
7: No such file or directory
Is it because the script tries to delete files while it is directories only?
Thanks,
Yves
Sorry, only registered users may post in this forum.