Setting up quota on a Partition with Writing Permissions
It could be danger to set up quota on a partition with writing permissions because the filesystem could be changed during the operations. If you didn't set up quota at the first place and now you want to set it up, this solution might be helpful.
Suppose /dev/sda5 is mounted on /home. First of all, we need to make following two files and change their permissions to 600 so that nobody else can access to them. Don't forget you need root privilege in order to perform all these tasks.
touch aquota.user aquota.group
chmod 600 aquota.*
Then you need to edit /etc/fstab. Add grpquota option if you need group quota.
/dev/sda5 /home jfs defaults,usrquota 0 1
Remount the partition.
mount -o remount /home
Repair the empty quota files you made.
quotacheck /home
With repquota -as, you will be able to see something like following
*** Report for user quotas on device /dev/sda5
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
----------------------------------------------------------------------
user1 -- 2455M 0 0 43119 0 0
user2 -- 56 0 0 5 0 0
user3 -- 256 0 0 16 0 0
user4 -- 941M 0 0 233k 0 0
It's done. Think twice before doing this if your server is critical.
Automated MySQL Backup Script
Please leave a comment if you have any suggestions or questions.
#!/bin/bash
#
# Automated MySQL backup script
#
# @author Sumin Byeon
# @since 20070815
# @version 20070927
dir="mysql"
databases=( db1 db2 db3 ... )
# The user must be an existing MySQL user with proper preveliges
user="backup"
password="your password"
for db in ${databases[@]}; do
timestamp=$(date +%Y%m%d%H%M%S)
filename=$dir/$db-$timestamp
mysqldump $db -u $user -p$password > $filename.sql
chmod 600 $filename.sql
tar jcf $filename.tar.bz2 $filename.sql
chmod 600 $filename.tar.bz2
rm $filename.sql
done
caught SIGTERM, shutting down
If you're looking for a solution for this problem, this is not what you're looking for. This is just a personal memo. Sorry.
September 2
Apache was dead in this morning again. This is the 4th time that I noticed so far. The Apache error logs said that
[Sun Sep 02 06:25:05 2007] [notice] caught SIGTERM, shutting down
I suspect mod_ssl does something to this.
September 9
It's been a week and it seems working fine. Hopefully it's permanent ;-)