-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathrun-seedmanager.pl
More file actions
executable file
·67 lines (54 loc) · 1.45 KB
/
run-seedmanager.pl
File metadata and controls
executable file
·67 lines (54 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/perl
# This file is part of IFMI PoolManager.
#
# PoolManager is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
use warnings;
use strict;
require '/opt/ifmi/sm-common.pl';
require '/opt/ifmi/smnotify.pl';
require '/opt/ifmi/ssendstatus.pl';
my $conf = &getConfig;
my %conf = %{$conf};
use Proc::PID::File;
if (Proc::PID::File->running()) {
# one at a time, please
print "Another run-seedmanager is running.\n";
exit(0);
}
# Start profile on boot
if ($conf{settings}{do_boot} == 1) {
my $uptime = `cat /proc/uptime`;
$uptime =~ /^(\d+)\.\d+\s+\d+\.\d+/;
my $rigup = $1;
if (($rigup < 300)) {
my $mcheck = `ps -eo command | grep -cE [P]M-miner`;
if ($mcheck == 0) {
&startCGMiner;
}
}
}
# broadcast node status
if ($conf{farmview}{do_bcast_status} == 1) {
&bcastStatus;
}
# Email
if ($conf{monitoring}{do_email} == 1) {
if (-f "/tmp/smnotify.lastsent") {
if (time - (stat ('/tmp/smnotify.lastsent'))[9] > ($conf{email}{smtp_min_wait} -10)) {
&doEmail;
}
} else { &doEmail; }
}
# Graphs should be no older than 5 minutes
my $graph = "/var/www/IFMI/graphs/smsummary.png";
if (-f $graph) {
if (time - (stat ($graph))[9] > 290) {
exec('/opt/ifmi/smgraph.pl');
}
} else {
exec('/opt/ifmi/smgraph.pl');
}