Skip to main content

Posts

Showing posts from June, 2014

Linux error: Too Many Open files

Too Many Open files, How Do I Fix This Problem? Many application such as Oracle database or Apache web server needs this range quite higher. So you can increase the maximum number of open files by setting a new value in kernel variable /proc/sys/fs/file-max as follows (login as the root): # sysctl -w fs.file-max=100000 Above command forces the limit to 100000 files. You need to edit /etc/sysctl.conf file and put following line so that after reboot the setting will remain as it is: # vi /etc/sysctl.conf Append a config directive as follows: fs.file-max = 100000 Save and close the file. Users need to log out and log back in again to changes take effect or just type the following command: # sysctl -p Verify your settings with command: # cat /proc/sys/fs/file-max OR # sysctl fs.file-max User Level FD Limits The above procedure sets system-wide file descriptors (FD) limits. However, you can limit httpd (or any other users) user to specific limits by editing /etc/security/limits.conf...

Linux: Find and Remove/Move older directories

Find and Removing directory: for i in `find /home/backup/ -maxdepth 1 -type d -mtime +7 -print`; do echo -e "Deleting directory $i";rm -rf $i; done for i in `find /var/ibbl_share/bach_sys_files/image/perm/inward/ -maxdepth 1 -type d -mtime +60 -print`; do echo -e "Moving directory $i";mv -vf $i /var/bach_central_repo/bach_sys_files/image/perm/inward/; done   Just to explain:  -maxdepth 1 = list only files/directories in 1 level from main search directory  -type d = list only directories  -mtime +7 = modified time of more than 7 days  -print = print out list; so we can then process the list with our bash script - Find Files By Access, Modification Date / Time Under Linux or UNIX You need to use the find command. Each file has three time stamps, which record the last time that certain operations were performed on the file: [a] access (read the file's contents) - atime [b] change the status (modify the file or its attributes) - ctime...