ed -i ‘/cdrom/d’ /etc/apt/sources.list
Monthly Archives: July 2015
disk space monitoring
#!/bin/sh
# Monitor disk space
pastas="[email protected]"
proc=85
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge $proc ]; then
echo "Lack of disk space \"$partition ($usep%)\" $(hostname) date $(date)" |
mail -s "Important! Disck space $usep" $pastas
fi
done
ubuntu install nvidia divers
sudo apt-get install nvidia-current
bash bytes coneverter to human
b2h()
{
# By: Simon Sweetwater
# Spotted Script @: http://www.linuxjournal.com/article/9293?page=0,1
# Convert input parameter (number of bytes)
# to Human Readable form
#
SLIST="bytes,KB,MB,GB,TB,PB,EB,ZB,YB"
POWER=1
VAL=$( echo "scale=2; $1 / 1" | bc)
VINT=$( echo $VAL / 1024 | bc )
while [ ! $VINT = "0" ]
do
let POWER=POWER+1
VAL=$( echo "scale=2; $VAL / 1024" | bc)
VINT=$( echo $VAL / 1024 | bc )
done
echo $VAL$( echo $SLIST | cut -f$POWER -d, )
}
k2h()
{
# Convert input parameter (number of kilobytes)
# Spotted Script @: http://www.linuxjournal.com/article/9293?page=0,1
# to Human Readable form
# MODIFIED BY kossboss
SLIST="bytes,KB,MB,GB,TB,PB,EB,ZB,YB"
POWER=1
VAL=$( echo "scale=2; $1 * 1024 / 1" | bc)
VINT=$( echo $VAL / 1024 | bc )
while [ ! $VINT = "0" ]
do
let POWER=POWER+1
VAL=$( echo "scale=2; $VAL / 1024" | bc)
VINT=$( echo $VAL / 1024 | bc )
done
echo $VAL$( echo $SLIST | cut -f$POWER -d, )
}
aide ide
yum install aide
aide -init
aide -check
aide -update
cron jobs and random time
4-59/5 * * * * root (sleep $(($RANDOM\%40+10))) && /usr/bin/some_script
[FATAL ERROR] Lock already exists: /var/run/munin/munin-update.lock. Dying.
rm -rf /var/run/munin/munin-update.lock
next:
su – munin –shell=/bin/bash
munin-cron