2 #/etc/rc.d/foldingathome-gpu
4 # Starts the Folding@Home-GPU client in the background
8 .
/etc
/conf.d
/foldingathome-gpu
10 PID
=`pidof -o %PPID Folding@home-Win32-gpu.exe`
13 read -s -n 1 -p "Press any key to continue . . ."
17 function checkconfigs
(){
18 if [ "$FAH_GPUS" -ge 1 ]; then
19 if [ -f /opt
/fah-gpu
/alpha
/client.cfg
]; then
20 echo "Client 1 is configured, ok to go."
22 echo "Client 1 needs to be configured!"
25 WINEPREFIX
=/opt
/fah-gpu
/ wine
/opt
/fah-gpu
/Folding@home-Win32-gpu.exe
-configonly $GPU_TYPE
28 if [ "$FAH_GPUS" -ge 2 ]; then
29 if [ -f /opt
/fah-gpu
/bravo
/client.cfg
]; then
30 echo "Client 2 is configured, ok to go."
32 echo "Client 2 needs to be configured!"
33 echo "Copying client.cfg from client 1"
34 cp /opt
/fah-gpu
/alpha
/client.cfg
/opt
/fah-gpu
/bravo
/
35 cd /opt
/fah-gpu
/bravo
&& cat client.cfg |
sed "s/machineid=2/machineid=3/g" > client.cfg
38 if [ "$FAH_GPUS" -ge 3 ]; then
39 if [ -f /opt
/fah-gpu
/charlie
/client.cfg
]; then
40 echo "Client 3 is configured, ok to go."
42 echo "Client 3 needs to be configured!"
43 echo "Copying client.cfg from client 1"
44 cp /opt
/fah-gpu
/alpha
/client.cfg
/opt
/fah-gpu
/charlie
/
45 cd /opt
/fah-gpu
/charlie
&& cat client.cfg |
sed "s/machineid=2/machineid=4/g" > client.cfg
48 if [ "$FAH_GPUS" -ge 4 ]; then
49 if [ -f /opt
/fah-gpu
/delta
/client.cfg
]; then
50 echo "Client 4 is configured, ok to go."
52 echo "Client 4 needs to be configured!"
53 echo "Copying client.cfg from client 1"
54 cp /opt
/fah-gpu
/alpha
/client.cfg
/opt
/fah-gpu
/delta
/
55 cd /opt
/fah-gpu
/delta
&& cat client.cfg |
sed "s/machineid=2/machineid=5/g" > client.cfg
58 if [ "$FAH_GPUS" -ge 5 ];then
59 if [ -f /opt
/fah-gpu
/echo
/client.cfg
]; then
60 echo "Client 5 is configured, ok to go."
62 echo "Client 5 needs to be configured!"
63 echo "Copying client.cfg from client 1"
64 cp /opt
/fah-gpu
/alpha
/client.cfg
/opt
/fah-gpu
/echo
/
65 cd /opt
/fah-gpu
/echo && cat client.cfg |
sed "s/machineid=2/machineid=6/g" > client.cfg
68 if [ "$FAH_GPUS" -ge 6 ];then
69 if [ -f /opt
/fah-gpu
/foxtrot
/client.cfg
]; then
70 echo "Client 6 is configured, ok to go."
72 echo "Client 6 needs to be configured!"
73 echo "Copying client.cfg from client 1"
74 cp /opt
/fah-gpu
/alpha
/client.cfg
/opt
/fah-gpu
/foxtrot
/
75 cd /opt
/fah-gpu
/foxtrot
&& cat client.cfg |
sed "s/machineid=2/machineid=7/g" > client.cfg
78 if [ "$FAH_GPUS" -ge 7 ];then
79 if [ -f /opt
/fah-gpu
/golf
/client.cfg
]; then
80 echo "Client 7 is configured, ok to go."
82 echo "Client 7 needs to be configured!"
83 echo "Copying client.cfg from client 1"
84 cp /opt
/fah-gpu
/alpha
/client.cfg
/opt
/fah-gpu
/golf
/
85 cd /opt
/fah-gpu
/golf
&& cat client.cfg |
sed "s/machineid=2/machineid=8/g" > client.cfg
88 if [ "$FAH_GPUS" -ge 8 ];then
89 if [ -f /opt
/fah-gpu
/hotel
/client.cfg
]; then
90 echo "Client 8 is configured, ok to go."
92 echo "Client 8 needs to be configured!"
93 echo "Copying client.cfg from client 1"
94 cp /opt
/fah-gpu
/alpha
/client.cfg
/opt
/fah-gpu
/hotel
/
95 cd /opt
/fah-gpu
/hotel
&& cat client.cfg |
sed "s/machineid=2/machineid=9/g" > client.cfg
98 if [ "$FAH_GPUS" -ge 9 ]; then
99 echo "You have too many GPUs set!"
104 if [ "$FAH_GPUS" -ge 1 ]; then
105 cd /opt
/fah-gpu
/alpha
106 WINEPREFIX
=/opt
/fah-gpu
/ wine
/opt
/fah-gpu
/Folding@home-Win32-gpu.exe
$GPU_TYPE -gpu 0 $FAH_CLIENT_FLAGS >> /dev
/null
2>&1 &
109 if [ "$FAH_GPUS" -ge 2 ]; then
110 cd /opt
/fah-gpu
/bravo
111 WINEPREFIX
=/opt
/fah-gpu
/ wine
/opt
/fah-gpu
/Folding@home-Win32-gpu.exe
$GPU_TYPE -gpu 1 $FAH_CLIENT_FLAGS >> /dev
/null
2>&1 &
114 if [ "$FAH_GPUS" -ge 3 ]; then
115 cd /opt
/fah-gpu
/charlie
116 WINEPREFIX
=/opt
/fah-gpu
/ wine
/opt
/fah-gpu
/Folding@home-Win32-gpu.exe
$GPU_TYPE -gpu 2 $FAH_CLIENT_FLAGS >> /dev
/null
2>&1 &
119 if [ "$FAH_GPUS" -ge 4 ]; then
120 cd /opt
/fah-gpu
/delta
121 WINEPREFIX
=/opt
/fah-gpu
/ wine
/opt
/fah-gpu
/Folding@home-Win32-gpu.exe
$GPU_TYPE -gpu 3 $FAH_CLIENT_FLAGS >> /dev
/null
2>&1 &
124 if [ "$FAH_GPUS" -ge 5 ]; then
126 WINEPREFIX
=/opt
/fah-gpu
/ wine
/opt
/fah-gpu
/Folding@home-Win32-gpu.exe
$GPU_TYPE -gpu 4 $FAH_CLIENT_FLAGS >> /dev
/null
2>&1 &
129 if [ "$FAH_GPUS" -ge 6 ]; then
130 cd /opt
/fah-gpu
/foxtrot
131 WINEPREFIX
=/opt
/fah-gpu
/ wine
/opt
/fah-gpu
/Folding@home-Win32-gpu.exe
$GPU_TYPE -gpu 5 $FAH_CLIENT_FLAGS >> /dev
/null
2>&1 &
134 if [ "$FAH_GPUS" -ge 7 ]; then
136 WINEPREFIX
=/opt
/fah-gpu
/ wine
/opt
/fah-gpu
/Folding@home-Win32-gpu.exe
$GPU_TYPE -gpu 6 $FAH_CLIENT_FLAGS >> /dev
/null
2>&1 &
139 if [ "$FAH_GPUS" -ge 8 ]; then
140 cd /opt
/fah-gpu
/hotel
141 WINEPREFIX
=/opt
/fah-gpu
/ wine
/opt
/fah-gpu
/Folding@home-Win32-gpu.exe
$GPU_TYPE -gpu 7 $FAH_CLIENT_FLAGS >> /dev
/null
2>&1 &
148 stat_busy
"Starting Folding@Home-GPU"
149 if [ -z "$PID" ]; then
150 if [ -d /opt
/fah-gpu
/drive_c
]; then
154 echo "WinePrefix non-existent, creating WinePrefix"
157 WINEPREFIX
=/opt
/fah-gpu wineboot
158 echo "WinePrefix has been created, restarting daemon."
160 /etc
/rc.d
/foldingathome-gpu start
164 if [ ! -z "$PID" -o $?
-gt 0 ]; then
167 add_daemon foldingathome-gpu
174 stat_busy
"Stopping Folding@Home-GPU"
175 [ ! -z "$PID" ]&& WINEPREFIX
=/opt
/fah-gpu wineserver
-k &> /dev
/null
176 if [ $?
-gt 0 ]; then
179 rm_daemon foldingathome-gpu
191 echo $
"Usage: $0 {start|stop|restart}"