Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!
Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.
Witam,
Głowię się nad moim skryptem w bashu juz dlugo. I nie mogę sobie z nim poradzić. Może znajdzie się ktoś kto mi podpowie jak to ugryźć. Jestem początkujący więc pewnie porobi lem błędy myślowe czy coś.
Założenie generalnie jest takie. Jeśli wysłalismy maila to nastepny możemy wysłać za X czasu dopiero. Coby nie spamować:)
#!/bin/bash #Check if the lockfile exists and is older than one minute EMAIL="ble@ble.pl" HOST_NAME=`echo $HOSTNAME | awk -F'.' '{print $1}'` USER=`exim -bp | grep "<" | awk {'print $5'} | cut -d "<" -f 2 | cut -d ">" -f 1 | sort -n | uniq -c | sort -n | awk '$1 >10' | awk {'print $2'} | cut -d "(" -f 2 | cut -d ")" -f 1` touch /tmp/$USER.lock exim -bp | grep "<" | awk {'print $NF $5'} | cut -d "<" -f 2 | cut -d ">" -f 1 | cut -d "(" -f 2 | cut -d ")" -f 1 | sort -n | uniq -c | sort -n | awk '$1 > 10' > tmp1.txt MINUTES=1 LOCKFILE=/tmp/$USER.lock if [ -f $LOCKFILE ]; then echo "Lockfile Exists" filestr=`find $LOCKFILE -mmin +$MINUTES -print` if [ "$filestr" = "" ]; then #echo "Lockfile is not older than $MINUTES minutes, exiting!" exit 1 else #echo "Lockfile is older than $MINUTES minutes, ignoring it and proceeding normal execution!" while read mailff emailff; do mail -s "[spam] $HOST_NAME $emailff" $EMAIL<<EOF Maili w kolejce: $mailff EOF done < tmp1.txt rm $LOCKFILE fi fi touch $LOCKFILE ##Do your stuff here echo $LOCKFILE #rm $LOCKFILE find /tmp -name "*.lock" -mmin +$MINUTES -exec rm -rf {} \; exit 0
Ostatnio edytowany przez shiver25 (2016-02-25 11:43:32)
Offline
Time (s) | Query |
---|---|
0.00015 | SET CHARSET latin2 |
0.00005 | SET NAMES latin2 |
0.00110 | SELECT u.*, g.*, o.logged FROM punbb_users AS u INNER JOIN punbb_groups AS g ON u.group_id=g.g_id LEFT JOIN punbb_online AS o ON o.ident='3.141.29.90' WHERE u.id=1 |
0.00125 | REPLACE INTO punbb_online (user_id, ident, logged) VALUES(1, '3.141.29.90', 1732427366) |
0.00057 | SELECT * FROM punbb_online WHERE logged<1732427066 |
0.00095 | SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM punbb_topics AS t INNER JOIN punbb_forums AS f ON f.id=t.forum_id LEFT JOIN punbb_forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=28311 AND t.moved_to IS NULL |
0.00007 | SELECT search_for, replace_with FROM punbb_censoring |
0.00115 | SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM punbb_posts AS p INNER JOIN punbb_users AS u ON u.id=p.poster_id INNER JOIN punbb_groups AS g ON g.g_id=u.group_id LEFT JOIN punbb_online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=28311 ORDER BY p.id LIMIT 0,25 |
0.00081 | UPDATE punbb_topics SET num_views=num_views+1 WHERE id=28311 |
Total query time: 0.0061 s |