linux系统管理脚本

查看系统上所有大于10M的文件,并且将/目录下的所有目录的大小计算出来,因为/mnt下是日志,所以不统计

#!/bin/bash
for I in `ls /`
do
if [ "$I" == "mnt" ];then
continue
else
du -sh "/$I"
find /$I -size +10M -exec du -sh {} \;
fi
done





ejabberd启动脚本

#!/bin/sh
#
# chkconfig: 2345 75 45
# description: ejabberdctl startup script
EJABBERDCTL=/usr/local/ejabberd-2.1.11/bin/ejabberdctl
USERNAME=player
#username is who running ejabberdctl
. /etc/rc.d/init.d/functions
RETVAL=0
case "$1" in
   start)
      let N=2
      echo -n "Starting EJABBERDCTL: "
      [ -f $EJABBERDCTL ] || exit 1
      while [ $N -eq 2 ];do
      let N=`ps aux | grep '/usr/local/ejabberd-2.1.11/bin/beam.smp' | wc -l`
      sleep 2
      done
      su -l $USERNAME -c "$EJABBERDCTL start"
      RETVAL=$?
      echo
      [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ejabberdctl
        ;;
  stop)
      echo -n "Shutting down EJABBERDCTL: "
      su -l deployer -c "$EJABBERDCTL stop"
      RETVAL=$?
      echo
      [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ejabberdctl
        ;;
  restart|reload)
        $0 stop
        $0 start
        RETVAL=$?
        ;;
  status)
        status ejabberdctl
        RETVAL=$?
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
esac
exit $RETVAL



本文出自 “那些日子” 博客,谢绝转载!

你可能感兴趣的:(啊)