{"@context":["https:\/\/www.w3.org\/ns\/activitystreams",{"Hashtag":"as:Hashtag","sensitive":"as:sensitive"}],"id":"https:\/\/www.cyber-neurones.org\/2017\/01\/tmpwatch-menage-dans-tmp-sous-linux-redhat-fedora\/","type":"Note","attachment":[],"attributedTo":"https:\/\/www.cyber-neurones.org\/author\/admin\/","content":"\u003Ch2\u003Etmpwatch : M\u00e9nage dans \/tmp\/ sous Linux Redhat \u0026#038; F\u00e9dora\u003C\/h2\u003E\u003Cp\u003EJe fais un petit rappel pour le m\u00e9nage (suppression) du r\u00e9pertoire \u003Cstrong\u003E\/tmp\/\u003C\/strong\u003E sous Linux. A la suite de l\u0026rsquo;\u00e9tude des logs de error.log de Apache j\u0026rsquo;ai pu voir que souvent le r\u00e9pertoire \/tmp\/ \u00e9tait complet.\u003C\/p\u003E\u003Cpre\u003E\u003Cstrong\u003Egrep \u0022No space left on device\u0022\u003C\/strong\u003E error.log.201701* | awk '{print $4 \u0022 \u0022 $3}' | sort -n | uniq -c\u00a0 85 18 Jan\u00a0114 19 Jan\u003C\/pre\u003E\u003Cp\u003EL\u0026rsquo;id\u00e9al est donc de modifier le param\u00e8tre de \u003Cspan style=\u0022color: #339966;\u0022\u003E\u003Cstrong\u003Etmpwatch\u003C\/strong\u003E\u003C\/span\u003E, par d\u00e9faut on a :\u003C\/p\u003E\u003Cpre\u003E# cat \/etc\/cron.daily\/tmpwatch#! \/bin\/shflags=-umc\/usr\/sbin\/\u003Cspan style=\u0022color: #339966;\u0022\u003E\u003Cstrong\u003Etmpwatch\u003C\/strong\u003E\u003C\/span\u003E \u0022$flags\u0022 -x \/tmp\/.X11-unix -x \/tmp\/.XIM-unix \\ -x \/tmp\/.font-unix -x \/tmp\/.ICE-unix -x \/tmp\/.Test-unix \\ -X '\/tmp\/hsperfdata_*' \u003Cspan style=\u0022color: #ff0000;\u0022\u003E\u003Cstrong\u003E10d\u003C\/strong\u003E\u003C\/span\u003E \/tmp\/usr\/sbin\/tmpwatch \u0022$flags\u0022 30d \/var\/tmpfor d in \/var\/{cache\/man,catman}\/{cat?,X11R6\/cat?,local\/cat?}; do if [ -d \u0022$d\u0022 ]; then \/usr\/sbin\/tmpwatch \u0022$flags\u0022 -f 30d \u0022$d\u0022 fidone\u003C\/pre\u003E\u003Cp\u003EPar d\u00e9faut le m\u00e9nage se fait donc tous les 10 jours, le plus propre est donc de modifier le temps plut\u00f4t que d\u0026rsquo;ajouter une autre tache cron qui ne va pas tenir compte de la date de cr\u00e9ation du fichier.\u003Cbr \/\u003EVoici le man :\u003C\/p\u003E\u003Cpre\u003ENAME tmpwatch - removes files which haven't been accessed for a period of time SYNOPSIS tmpwatch [-u|-m|-c] [-MUXadfqstvx] [--verbose] [--force] [--all] [--nodirs] [--nosymlinks] [--test] [--fuser] [--quiet] [--atime|--mtime|--ctime] [--dirmtime] [--exclude path] [--exclude-user user] [--exclude-pattern pattern] time dirs DESCRIPTION tmpwatch recursively removes files which haven't been accessed for a given time. Normally, it's used to clean up directories which are used for temporary holding space such as \/tmp. When changing directories, tmpwatch is very sensitive to possible race conditions and will exit with an error if one is detected. It does not follow symbolic links in the directories it's cleaning (even if a symbolic link is given as its argument), does not switch filesystems (including non-trivial bind mounts), skips lost+found directories owned by the root user, and only removes empty directories, regular files, and symbolic links. By default, tmpwatch dates files by their atime (access time), not their mtime (modification time). If files aren't being removed when ls -l implies they should be, use ls -u to examine their atime to see if that explains the problem. If the --atime, --ctime or --mtime options are used in combination, the decision about deleting a file will be based on the maximum of these times. The --dirmtime option implies ignoring atime of directories, even if the --atime option is used. The time parameter defines the threshold for removing files. If the file has not been accessed for time, the file is removed. The time argument is a number with an optional single-char\u2010 acter suffix specifying the units: \u003Cstrong\u003E\u003Cspan style=\u0022color: #ff0000;\u0022\u003Em for minutes, h for hours, d for days\u003C\/span\u003E\u003C\/strong\u003E. If no suffix is specified, time is in hours. Following this, one or more directories may be given for tmpwatch to clean up.\u003C\/pre\u003E\u003Cp\u003EJe pense que le mieux est de passer de 10 jours \u00e0 10 heures. Pour du site Web (Apache, MySQL, PHP), je pense que c\u0026rsquo;est largement suffisant 10h dans le r\u00e9pertoire \/tmp\/. Disons que PHP ne va faire un fichier qui va durer plus que le temps maximum dans php.ini , et une session ne devrait pas durer plus de 10h.\u003C\/p\u003E\u003Cp\u003E\u0026nbsp;\u003C\/p\u003E\u003Cdiv class='yarpp yarpp-related yarpp-related-website yarpp-template-list'\u003E\u003C!-- YARPP List --\u003E\u003C\/p\u003E\u003Ch3\u003ERelated posts:\u003C\/h3\u003E\u003Col\u003E\u003Cli\u003E\u003Ca href=\u0022https:\/\/www.cyber-neurones.org\/2017\/01\/module-apache-mod_ratelimit-rate-limiterror-rl-conn-aborted\/\u0022 rel=\u0022bookmark\u0022 title=\u0022Module Apache mod_ratelimit : rate limit:error : rl: conn aborted\u0022\u003EModule Apache mod_ratelimit : rate limit:error : rl: conn aborted\u003C\/a\u003E\u003C\/li\u003E\u003C\/ol\u003E\u003C\/div\u003E\u003Cp\u003E\u003Ca rel=\u0022tag\u0022 class=\u0022hashtag u-tag u-category\u0022 href=\u0022https:\/\/www.cyber-neurones.org\/tag\/phpnet-org\/\u0022\u003E#PHPNETORG\u003C\/a\u003E\u003C\/p\u003E","contentMap":{"fr":"\u003Ch2\u003Etmpwatch : M\u00e9nage dans \/tmp\/ sous Linux Redhat \u0026#038; F\u00e9dora\u003C\/h2\u003E\u003Cp\u003EJe fais un petit rappel pour le m\u00e9nage (suppression) du r\u00e9pertoire \u003Cstrong\u003E\/tmp\/\u003C\/strong\u003E sous Linux. A la suite de l\u0026rsquo;\u00e9tude des logs de error.log de Apache j\u0026rsquo;ai pu voir que souvent le r\u00e9pertoire \/tmp\/ \u00e9tait complet.\u003C\/p\u003E\u003Cpre\u003E\u003Cstrong\u003Egrep \u0022No space left on device\u0022\u003C\/strong\u003E error.log.201701* | awk '{print $4 \u0022 \u0022 $3}' | sort -n | uniq -c\u00a0 85 18 Jan\u00a0114 19 Jan\u003C\/pre\u003E\u003Cp\u003EL\u0026rsquo;id\u00e9al est donc de modifier le param\u00e8tre de \u003Cspan style=\u0022color: #339966;\u0022\u003E\u003Cstrong\u003Etmpwatch\u003C\/strong\u003E\u003C\/span\u003E, par d\u00e9faut on a :\u003C\/p\u003E\u003Cpre\u003E# cat \/etc\/cron.daily\/tmpwatch#! \/bin\/shflags=-umc\/usr\/sbin\/\u003Cspan style=\u0022color: #339966;\u0022\u003E\u003Cstrong\u003Etmpwatch\u003C\/strong\u003E\u003C\/span\u003E \u0022$flags\u0022 -x \/tmp\/.X11-unix -x \/tmp\/.XIM-unix \\ -x \/tmp\/.font-unix -x \/tmp\/.ICE-unix -x \/tmp\/.Test-unix \\ -X '\/tmp\/hsperfdata_*' \u003Cspan style=\u0022color: #ff0000;\u0022\u003E\u003Cstrong\u003E10d\u003C\/strong\u003E\u003C\/span\u003E \/tmp\/usr\/sbin\/tmpwatch \u0022$flags\u0022 30d \/var\/tmpfor d in \/var\/{cache\/man,catman}\/{cat?,X11R6\/cat?,local\/cat?}; do if [ -d \u0022$d\u0022 ]; then \/usr\/sbin\/tmpwatch \u0022$flags\u0022 -f 30d \u0022$d\u0022 fidone\u003C\/pre\u003E\u003Cp\u003EPar d\u00e9faut le m\u00e9nage se fait donc tous les 10 jours, le plus propre est donc de modifier le temps plut\u00f4t que d\u0026rsquo;ajouter une autre tache cron qui ne va pas tenir compte de la date de cr\u00e9ation du fichier.\u003Cbr \/\u003EVoici le man :\u003C\/p\u003E\u003Cpre\u003ENAME tmpwatch - removes files which haven't been accessed for a period of time SYNOPSIS tmpwatch [-u|-m|-c] [-MUXadfqstvx] [--verbose] [--force] [--all] [--nodirs] [--nosymlinks] [--test] [--fuser] [--quiet] [--atime|--mtime|--ctime] [--dirmtime] [--exclude path] [--exclude-user user] [--exclude-pattern pattern] time dirs DESCRIPTION tmpwatch recursively removes files which haven't been accessed for a given time. Normally, it's used to clean up directories which are used for temporary holding space such as \/tmp. When changing directories, tmpwatch is very sensitive to possible race conditions and will exit with an error if one is detected. It does not follow symbolic links in the directories it's cleaning (even if a symbolic link is given as its argument), does not switch filesystems (including non-trivial bind mounts), skips lost+found directories owned by the root user, and only removes empty directories, regular files, and symbolic links. By default, tmpwatch dates files by their atime (access time), not their mtime (modification time). If files aren't being removed when ls -l implies they should be, use ls -u to examine their atime to see if that explains the problem. If the --atime, --ctime or --mtime options are used in combination, the decision about deleting a file will be based on the maximum of these times. The --dirmtime option implies ignoring atime of directories, even if the --atime option is used. The time parameter defines the threshold for removing files. If the file has not been accessed for time, the file is removed. The time argument is a number with an optional single-char\u2010 acter suffix specifying the units: \u003Cstrong\u003E\u003Cspan style=\u0022color: #ff0000;\u0022\u003Em for minutes, h for hours, d for days\u003C\/span\u003E\u003C\/strong\u003E. If no suffix is specified, time is in hours. Following this, one or more directories may be given for tmpwatch to clean up.\u003C\/pre\u003E\u003Cp\u003EJe pense que le mieux est de passer de 10 jours \u00e0 10 heures. Pour du site Web (Apache, MySQL, PHP), je pense que c\u0026rsquo;est largement suffisant 10h dans le r\u00e9pertoire \/tmp\/. Disons que PHP ne va faire un fichier qui va durer plus que le temps maximum dans php.ini , et une session ne devrait pas durer plus de 10h.\u003C\/p\u003E\u003Cp\u003E\u0026nbsp;\u003C\/p\u003E\u003Cdiv class='yarpp yarpp-related yarpp-related-website yarpp-template-list'\u003E\u003C!-- YARPP List --\u003E\u003C\/p\u003E\u003Ch3\u003ERelated posts:\u003C\/h3\u003E\u003Col\u003E\u003Cli\u003E\u003Ca href=\u0022https:\/\/www.cyber-neurones.org\/2017\/01\/module-apache-mod_ratelimit-rate-limiterror-rl-conn-aborted\/\u0022 rel=\u0022bookmark\u0022 title=\u0022Module Apache mod_ratelimit : rate limit:error : rl: conn aborted\u0022\u003EModule Apache mod_ratelimit : rate limit:error : rl: conn aborted\u003C\/a\u003E\u003C\/li\u003E\u003C\/ol\u003E\u003C\/div\u003E\u003Cp\u003E\u003Ca rel=\u0022tag\u0022 class=\u0022hashtag u-tag u-category\u0022 href=\u0022https:\/\/www.cyber-neurones.org\/tag\/phpnet-org\/\u0022\u003E#PHPNETORG\u003C\/a\u003E\u003C\/p\u003E"},"published":"2017-01-23T17:47:41Z","tag":[{"type":"Hashtag","href":"https:\/\/www.cyber-neurones.org\/tag\/phpnet-org\/","name":"#PHPNETORG"}],"updated":"2017-01-23T19:23:23Z","url":"https:\/\/www.cyber-neurones.org\/2017\/01\/tmpwatch-menage-dans-tmp-sous-linux-redhat-fedora\/","to":["https:\/\/www.w3.org\/ns\/activitystreams#Public"],"cc":["https:\/\/www.cyber-neurones.org\/wp-json\/activitypub\/1.0\/actors\/1\/followers"],"replies":{"id":"https:\/\/www.cyber-neurones.org\/wp-json\/activitypub\/1.0\/posts\/10146\/replies","type":"Collection","first":{"id":"https:\/\/www.cyber-neurones.org\/wp-json\/activitypub\/1.0\/posts\/10146\/replies?page=0","type":"CollectionPage","partOf":"https:\/\/www.cyber-neurones.org\/wp-json\/activitypub\/1.0\/posts\/10146\/replies","items":[]}},"sensitive":false}