Questions and Answers :
Unix/Linux :
"Extended" boot script for boinc
Message board moderation
Author | Message |
---|---|
shtrom Send message Joined: 16 Nov 00 Posts: 4 Credit: 90,509 RAC: 0 |
Hi I wrote a little script I formerly used to start my seti@home clients, and modified to start my BOINC client. It handles running BOINC as another user, nice'ing the process, starting/stopping, returning the results _really_ immediately (modifying the rpc_min_time field before restarting the client) and stats (I'm using BOINCStats). I figured it may be useful to other, so here it is. Enjoy. --------->8----[cut here]-------- #!/bin/bash # SysV-like script to manage the BOINC client # Copyright (C) 2004, Olivier Mehani # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # boinc parameters boincuser=seti boincdir=/usr/local/boinc boincbin=boinc_4.09_i686-pc-linux-gnu boincstat=/usr/local/bin/boincstat boincnice=19 # program locations cp=/bin/cp rm=/bin/rm su=/bin/su nice=/usr/bin/nice sleep=/usr/bin/sleep killall=/bin/killall sed=/usr/bin/sed date=/usr/bin/date # not to be modified variables client_state=$boincdir/client_state.xml # useful functions function boinc_start () { pushd $boincdir >/dev/null if [ "$1" == "quiet" ]; then shift $su $boincuser -c "$nice -$boincnice ./$boincbin $* 1>/dev/null 2>/dev/null &" else $su $boincuser -c "$nice -$boincnice ./$boincbin $* &" fi popd >/dev/null } function boinc_stop () { $killall $boincbin 2>/dev/null } function reset_min_rpc_time () { old_client_state=$client_state.old $cp $client_state $old_client_state $sed -e "s-[[:digit:]]\\+-`$date +s`-" $old_client_state > $client_state $rm $old_client_state } # command line parsing case "$1" in "start") echo "Starting BOINC: nice -$boincnice $boincdir/$boincbin" boinc_start $2 ;; "stop") echo "Stopping BOINC..." boinc_stop ;; "restart") echo "Restarting BOINC..." boinc_stop && $sleep 10 boinc_start $2 ;; "return-results") echo "Restarting BOINC to send results..." boinc_stop && $sleep 10 reset_min_rpc_time boinc_start $2 -return_results_immediately ;; "update-prefs") echo "Restarting BOINC to update prefs" boinc_stop && $sleep 10 boinc_start $2 -update_prefs http://setiweb.ssl.berkeley.edu/ ;; "stats") shift su $boincuser -c "$boincstat -d $boincdir $*" ;; *) echo "Usage: $0 start|stop|restart|stats|return-results|update-prefs" esac --------->8----[cut here too]---- -- Olivier Mehani |
ML1 Send message Joined: 25 Nov 01 Posts: 20291 Credit: 7,508,002 RAC: 20 |
> I wrote a little script Neatly done, thanks. Regards, Martin |
©2024 University of California
SETI@home and Astropulse are funded by grants from the National Science Foundation, NASA, and donations from SETI@home volunteers. AstroPulse is funded in part by the NSF through grant AST-0307956.