| 1 |
# |
| 2 |
# Edit the following for your setup |
| 3 |
# |
| 4 |
USER=apache |
| 5 |
# CRONTAB not used |
| 6 |
#CRONTAB=/var/spool/cron/tabs/$(USER) |
| 7 |
RRDPATH=/usr/bin |
| 8 |
BINPATH=/usr/local/bin |
| 9 |
RRDDIR=/var/lib/sensors-rrd |
| 10 |
APACHE=/var/www/html |
| 11 |
APACHDIR=$(APACHE)/senspix |
| 12 |
MACH=`uname -n` |
| 13 |
SENSDEV=hwmon0 |
| 14 |
SENSDIR=/sys/class/hwmon/$(SENSDEV)/device |
| 15 |
################################################ |
| 16 |
# Everything below here should be fine |
| 17 |
# |
| 18 |
RRDB=$(RRDDIR)/sensors.rrd |
| 19 |
|
| 20 |
all: sens_day.cgi sens_week.cgi summ_week.cgi $(SENSDIR) |
| 21 |
|
| 22 |
%.cgi : %.in Makefile |
| 23 |
sed -e "s#%%RRDPATH%%#$(RRDPATH)#g;s#%%APACHDIR%%#$(APACHDIR)#g;s#%%RRDDIR%%#$(RRDDIR)#g;s#%%MACH%%#$(MACH)#g" $< > $@ |
| 24 |
|
| 25 |
$(RRDDIR) : |
| 26 |
install -d -o $(USER) $(RRDDIR) |
| 27 |
|
| 28 |
$(RRDB) : $(RRDDIR) |
| 29 |
./sens_create_rrd $(RRDB) |
| 30 |
chown $(USER) $(RRDB) |
| 31 |
|
| 32 |
$(SENSDIR) : |
| 33 |
$(error error - sensor $(SENSDEV) not installed - check SENSDEV definition in Makefile) |
| 34 |
|
| 35 |
$(CRONTAB) : |
| 36 |
$(error error - crontab for user $(USER) not present - check CRONTAB definition in Makefile) |
| 37 |
|
| 38 |
$(APACHE) : |
| 39 |
$(error error - Web server directory $(APACHE) not present - check APACHE definition in Makefile) |
| 40 |
|
| 41 |
$(APACHDIR)/pix : $(APACHE) |
| 42 |
install -d -o $(USER) -m 777 $(APACHDIR)/pix |
| 43 |
|
| 44 |
install: all $(RRDB) $(SENSDIR) $(CRONTAB) $(APACHDIR)/pix |
| 45 |
install -m 755 sens_update_rrd $(BINPATH) |
| 46 |
install -m 755 sens_week.cgi $(APACHDIR) |
| 47 |
install -m 755 sens_day.cgi $(APACHDIR) |
| 48 |
install -m 755 summ_week.cgi $(APACHDIR) |
| 49 |
# grep sens_update_rrd $(CRONTAB) > /dev/null 2>&1 || echo '*/5 * * * * /usr/local/bin/sens_update_rrd' $(RRDB) $(SENSDEV) >> $(CRONTAB) |
| 50 |
@echo |
| 51 |
@echo Note!!! You must manually install the following line in the crontab for user $(USER): |
| 52 |
@echo ' */5 * * * * ' /usr/local/bin/sens_update_rrd $(RRDB) $(SENSDEV) |
| 53 |
|
| 54 |
clean: |
| 55 |
rm -f sens_day.cgi sens_week.cgi summ_week.cgi |