4 * Copyright (C) 2011 shibby
15 // always copy and try start service if USB support is enable
16 // if service will not find apc ups, then will turn off automaticaly
17 // if( nvram_match( "ups_enable", "1" ) )
20 eval("cp", "/www/apcupsd/tomatodata.cgi", "/www/ext/cgi-bin/tomatodata.cgi");
21 eval("cp", "/www/apcupsd/tomatoups.cgi", "/www/ext/cgi-bin/tomatoups.cgi");
23 // writing data to file
25 /* turn off at the moment. We will use this in the future.
26 if( !( fpc = fopen( "/etc/apcupsd.conf", "w" ) ) )
28 perror( "/etc/apcupsdd.conf" );
31 fprintf( fpc, "USBCABLE usb \n");
32 fprintf( fpc, "UPSTYPE usb \n");
33 fprintf( fpc, "DEVICE \n");
34 fprintf( fpc, "EVENTSFILE /var/log/apcupsd.events \n");
37 chmod( "/etc/apcupsd.conf", 0644 );
39 if( !( fpm = fopen( "/etc/apcemail.conf", "w" ) ) )
41 perror( "/etc/apcemail.conf" );
44 fprintf( fpm, "SYSADMIN=myemail@domain.com \n");
45 fprintf( fpm, "APCUPSD_MAIL=\"sendmail -S server.home -f root\" \n");
48 chmod( "/etc/apcemail.conf", 0644 );
58 killall("apcupsd", SIGTERM
);
59 // eval("rm", "/etc/apcupsd.conf");
60 // eval("rm", "/etc/apcemail.conf");
61 // eval("rm", "/www/ext/cgi-bin/tomatodata.cgi");
62 // eval("rm", "/www/ext/cgi-bin/tomatoups.cgi");