This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# From https://anothersysadmin.wordpress.com/2008/10/29/kill-every-mysql-select-older-than-x-seconds/ | |
SEC=$1 | |
IFS='|' | |
if [[ $SEC -lt 1 ]]; then | |
echo "Usage: $0 SECONDS" | |
exit 1 | |
fi | |
mysqladmin proc -v|grep Query|grep -Evi "delete|update|insert|alter table" |while read dummy qid qusr qhost qdb qstat qsec qstat2 query; do | |
if [ $qsec -gt $SEC ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar -cavf BENPRO_USB_BTS_LP.tar.lzo BENPRO_USB 1,17s user 1,31s system 36% cpu 6,817 total | |
440M 25 mars 19:37 BENPRO_USB_BTS_LP.tar.lzo | |
tar -cavf BENPRO_USB_BTS_LP.tar.gz BENPRO_USB 26,02s user 1,41s system 95% cpu 28,826 total | |
401M 25 mars 19:39 BENPRO_USB_BTS_LP.tar.gz | |
tar -cavf BENPRO_USB_BTS_LP.tar.xz BENPRO_USB 272,47s user 2,83s system 100% cpu 4:34,75 total | |
314M 25 mars 19:44 BENPRO_USB_BTS_LP.tar.xz | |
tar -cavf BENPRO_USB_BTS_LP.tar.bz2 BENPRO_USB 96,16s user 1,97s system 99% cpu 1:38,66 total |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
[email protected] | |
subject="Warning: Temperature critical" | |
critical=50 | |
temperature=$(sensors -u coretemp-isa-0000 | grep temp2_input | grep -Eo "[0-9.]{2,}") | |
calc=$(echo "$temperature >= $critical" | bc) | |
if (( $calc )); then | |
echo -e "Attention, la température du processeur de la machine samba a dépassé le seuil\nde $critical °C ! Elle est actuellement de $temperature °C.\n\nVérifiez la climatisation de la salle serveur." | mail -s "$subject" "$mailto" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in $(mailq | grep -Eo [A-F0-9]{10} | tr -s '\n' ' '); do postcat -q $i | grep userid | grep -Eo "[0-9]{4,}" >> tmp/userid; done | |
sort -n /tmp/userid | uniq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Simple Twitter backup script | |
date=$(date +'%Y-%m-%d') | |
t timeline @benpro82 --csv --number 3000 > tweets-$date.csv | |
t retweets --csv --number 3000 > retweets-$date.csv | |
t favorites --csv --number 3000 > favorites-$date.csv | |
t direct_messages --csv --number 3000 > dm_received-$date.csv | |
t direct_messages_sent --csv --number 3000 > dm_sent-$date.csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
regex="([A-Za-zéôçèÉÊ-]+) ([A-Za-zéôçèÉÊ-]+) <([a-zA-Z]){1}[a-z-]+\.([a-z]+)" | |
regex2="<(.*)>" | |
lastuidNumber=3075 | |
while read line; do | |
[[ $line =~ $regex ]] | |
# Get name | |
lastName=${BASH_REMATCH[1]} | |
firstName=${BASH_REMATCH[2]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SRC Server | |
mysql mysql -e "select * from user WHERE USER='user1' OR USER='user2' INTO OUTFILE '/tmp/mysql_user';" | |
mysql mysql -e "select * from db WHERE USER='user1' OR USER='user2' INTO OUTFILE '/tmp/mysql_db';" | |
# DST Server | |
scp server:/tmp/mysql_{db,user} /tmp | |
chmod 664 /tmp/mysql_{db,user} | |
mysql mysql -e "LOAD DATA INFILE '/tmp/mysql_user' INTO TABLE user;" | |
mysql mysql -e "LOAD DATA INFILE '/tmp/mysql_db' INTO TABLE db;" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tail -n100 /var/log/squid3/access.log | grep -oE 'http.*' | cut -d ' ' -f1 | sort | uniq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
avconv -f x11grab -r 5 -s 800x641 -i :0.0+1060,69 -vcodec libvpx -pre libvpx-720p output.webm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- evomaintenance.old 2013-08-09 16:46:33.677096878 +0200 | |
+++ evomaintenance.sh 2013-08-09 16:47:53.656405527 +0200 | |
@@ -44,6 +44,13 @@ | |
echo "To cancel, [Ctrl+C] else press [Enter]" | |
read enter | |
+# GIT part. Commit all modifications for /etc. | |
+if [ -d /etc/.git ]; then | |
+ cd /etc/ | |
+ git add . |