Είναι γεγονός! Το νέο εξελιγμένο script -mfah- με μπλε και πράσινους κόκκους είναι εδώ!
Changelog:
-Μίκρυνα λίγο την γραμμή με τις πληροφορίες για να χωράει σε μικρότερα terminal.
-Πλέον το script υπολογίζει το χρόνο που χρειάζεται για να τελειώσει μία πρωτεΐνη!
Το script λαμβάνει υπόψιν του αν η πρωτεΐνη ξεκίνησε το προηγούμενο χρόνο (δεν μασάει ούτε στα δίσεκτα), ενώ σας ενημερώνει αν δεν μπορεί να υπολογίσει σωστά τον χρόνο που απαιτείται για την ολοκλήρωση της πρωτεΐνης επειδή δεν έχει αρκετά δεδομένα.
Screenshot Emulation (τι βλέπω όταν το τρέχω στο pc μου)
Κώδικας:
mrsaccess@ElectraWS MariosProTools $ ./mfah
ElectraII client1: 33% [ WU name: p2306_BBA5_pfold in water, from Feb 25 23:38, till Apr 19 23:38 ]
Runtime from start : 28h 32m.
Estimated time remaining: 57h 57m
ElectraII client2: 1% [ WU name: p2306_BBA5_pfold in water, from Feb 27 02:47, till Apr 21 02:47 ]
Runtime from start : 1h 24m.
Estimated time remaining: 138h 54m (Warning! Progress is in too early stage for accurate estimation.)
Sempron client: 62% [ WU name: p2306_BBA5_pfold in water, from Feb 26 08:55, till Apr 20 08:55 ]
Runtime from start : 19h 16m.
Estimated time remaining: 11h 48m.
mrsaccess@ElectraWS MariosProTools $
Εγκατάσταση
»Κατεβάζετε το script ή οι πιο άπιστοι κάνετε το κώδικα copy-paste σε ένα νέο αρχείο.
»Το ανοίγετε με τον αγαπημένο σας editor.
»Ορίζετε στην μεταβλητή GMT_diff τη διαφορά ώρας του υπολογιστή σας από την ώρα GMT. Λογικά δεν θα χρειαστεί να το πειράξετε, θα το αφήσετε 2. Αν ωστόσο έχετε ρυθμίσει τον υπολογιστή σας σε ώρα GMT τότε κάνετέ το 0.
»Πηγαίνετε στο τέλος του αρχείου και ρυθμίζεται τους clients σας.
Για κάθε client προσθέτετε μια τέτοια γραμμή:
printFaHclient "πως θέλετε να λέγεται ο client" /directory/που/είναι/εγκατεστημένος
» Ως root αντιγράφετε το αρχείο στο /usr/bin σας, το κάνετε εκτελέσιμο και του δίνετε σωστά permissions:
cp mfah /usr/bin
chown root:root /usr/bin/mfah
chmod 755 /usr/bin/mfah
Για να το τρέξετε πλέον, σε μια οποιαδήποτε κονσόλα δώστε mfah
Ο κώδικας για τους άπιστους:
Κώδικας:
#########################################
# mfolding@home v2.0 #
# Script by Marios Andreopoulos #
# #
# A really basic script for viewing #
# "Folding@Home" clients' stats in a #
# nice way at a linux terminal :-) #
# #
# The script is so basic you are #
# allowed to do whatever you want #
# with it! #
# Have fun and be creative! #
#########################################
# Usage:
# Just go to the end and use the printFaHclient function to print
# info for as many clients as you want.
#
# i.e. You have a Folding@Home client installed at /foo/bar and you want to refer to it as "My PC client1"
# Then you add this line at the end of the script:
# printFaHclient "My PC client1" /foo/bar
# Just do it for as many clients you want
#
# Oh, one last thing. Remember to change the GMT_diff variable according to your computer's timesettings.
#!/bin/bash
#Please change this according to your PC time difference from the GMT.
#You can use negative numbers, but do not use signs in positive ones.
#For example if you have your machine configured to Greek Local Time then you are 2 hours ahead GMT.
GMT_diff=2
printFaHclient() {
Progress=$(grep -o "Progress.*%" $2/unitinfo.txt | sed -e 's/.*ress: //' | sed -e 's/\%//')
# Print Client Info
echo
echo -ne "\033[1m$1:\033[35m "
echo -n $Progress%
echo -ne "\033[0m [\033[;36m WU name: "
echo -ne `grep Name $2/unitinfo.txt | sed -e 's/Name: //'`"\033[0m"
echo -ne ", \033[32mfrom "$(date -d "$(grep Download $2/unitinfo.txt | sed -e 's/.*time: //')" +%b\ %e\ %H:%M)
echo -e "\033[0m, \033[31mtill "$(date -d "$(grep Due $2/unitinfo.txt | sed -e 's/.*time: //')" +%b\ %e\ %H:%M)"\033[0m ]"
# Estimate hours to completion
if (( $Progress == 0 )); then #Check if we can make estimations.
echo -e "\033[1;36;5mNo enough data to estimate hours to completion.\033[0m"
else
NOW=$(expr $(date +%s) - $(expr $GMT_diff \* 3600))
START=$(date -d "$(grep Download $2/unitinfo.txt | sed -e 's/.*time: //')" +%s)
Running=$(expr $NOW - $START)
if (( Running < 0 )); then #Check if the unit started in the previous year.
if (( $(expr $(expr $(date +%G) - 1) % 4) == 0 )); then #Check if the previous year was leap.
START=$(expr $START - 31622400)
else
START=$(expr $START - 31536000)
fi
Running=$(expr $(expr $NOW - $START))
fi
Remaining=$(expr $(expr $Running \* $(expr 100 - $Progress)) / $Progress)
if (( $Remaining == 0 )); then #Check if we can make estimations.
echo -e "\033[1;36;5mNo enough data to estimate hours to completion.\033[0m"
else
echo -e "\033[1;32mRuntime from start : $(expr $Running / 3600)h $(expr $(expr $Running % 3600) / 60)m"
echo -ne "\033[1;31mEstimated time remaining: $(expr $Remaining / 3600)h $(expr $(expr $Remaining % 3600) / 60)m\033[0m"
if (( $Progress < 10 )); then #Check if accuracy is compromised by short progress.
echo " (Warning! Progress is in too early stage for accurate estimation.)"
fi
echo
fi
fi
}
# Here you add the clients you want to print info for. Some examples follow.
# printFaHclient "ServerPC Client1" /home/user/foldingathome1
# printFaHclient "ServerPC Client2" /home/user/foldingathome2
Διορθώσεις υποδείξεις δεκτές!
Thanx @ mich83 που μου πρότεινε να το κάνω!
Bookmarks