File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,3 +27,4 @@ MSMNTDIR=/mnt
2727COMPONENTS-SPEC =components.xml
2828AWSAPILOG =awsapi.log
2929REMOTEHOST =localhost
30+ COMMONLIBDIR =C:\Users\htrippaers\eclipse_workspace\cloudstack\client\t arget\cloud-client-ui-4.2.0-SNAPSHOT\WEB-INF\classes
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ export JAVA_HOME
5858
5959SCP=" "
6060DCP=" "
61- UCP=` ls /usr/share/cloudstack-usage/cloud-usage-* .jar` " :" ` ls /usr/share/cloudstack-usage/lib/* | tr ' \n' ' :' `
61+ UCP=` ls /usr/share/cloudstack-usage/cloud-usage-* .jar` " :" ` ls /usr/share/cloudstack-usage/lib/* .jar | tr ' \n' ' :' `
6262JCP=" /usr/share/java/commons-daemon.jar"
6363
6464# We need to append the JSVC daemon JAR to the classpath
Original file line number Diff line number Diff line change @@ -447,13 +447,6 @@ if [ -f "%{_sysconfdir}/%{name}/management/db.properties" ]; then
447447 ln -s %{_sysconfdir}/%{name}/management/db.properties %{_sysconfdir}/%{name}/usage/db.properties
448448fi
449449
450- if [ -f "%{_sysconfdir }/%{name }/management/log4j-cloud.xml" ]; then
451- echo Replacing log4j-cloud.xml with management server log4j-cloud.xml
452- rm -f %{_sysconfdir }/%{name }/usage/log4j-cloud.xml
453- ln -s %{_sysconfdir }/%{name }/management/log4j-cloud.xml %{_sysconfdir }/%{name }/usage/log4j-cloud.xml
454- fi
455-
456-
457450#%post awsapi
458451#if [ -d "%{_datadir}/%{name}-management" ] ; then
459452# ln -s %{_datadir}/%{name}-bridge/webapps %{_datadir}/%{name}-management/webapps7080
548541%attr(0755,root,root) %{_sysconfdir }/init.d/%{name }-usage
549542%attr(0644,root,root) %{_datadir }/%{name }-usage/* .jar
550543%attr(0644,root,root) %{_datadir }/%{name }-usage/lib/* .jar
551- %dir /var /log/%{name }/usage
544+ %dir %attr(0770,root,cloud) %{ _localstatedir } /log/%{name }/usage
552545%attr(0644,root,root) %{_sysconfdir }/%{name }/usage/db.properties
553546%attr(0644,root,root) %{_sysconfdir }/%{name }/usage/log4j-cloud.xml
554547%{_defaultdocdir }/%{name }-usage-%{version }/LICENSE
Original file line number Diff line number Diff line change @@ -56,5 +56,5 @@ SYSCONFDIR=/etc/sysconfig
5656SYSTEMCLASSPATH =
5757SYSTEMJARS =
5858USAGECLASSPATH =
59- USAGELOG =/var/log/cloudstack/usage
59+ USAGELOG =/var/log/cloudstack/usage/usage.log
6060USAGESYSCONFDIR =/etc/sysconfig
Original file line number Diff line number Diff line change 3737 <version >${cs.mysql.version} </version >
3838 <scope >runtime</scope >
3939 </dependency >
40+ <dependency >
41+ <groupId >commons-daemon</groupId >
42+ <artifactId >commons-daemon</artifactId >
43+ <version >1.0.10</version >
44+ </dependency >
4045 </dependencies >
4146 <build >
4247 <defaultGoal >install</defaultGoal >
Original file line number Diff line number Diff line change 1919import java .io .File ;
2020import java .io .FileNotFoundException ;
2121
22+ import org .apache .commons .daemon .Daemon ;
23+ import org .apache .commons .daemon .DaemonContext ;
24+ import org .apache .commons .daemon .DaemonInitException ;
2225import org .apache .log4j .Logger ;
2326import org .apache .log4j .PropertyConfigurator ;
2427import org .apache .log4j .xml .DOMConfigurator ;
2932import com .cloud .utils .PropertiesUtil ;
3033import com .cloud .utils .component .ComponentContext ;
3134
32- public class UsageServer {
35+ public class UsageServer implements Daemon {
3336 private static final Logger s_logger = Logger .getLogger (UsageServer .class .getName ());
3437 public static final String Name = "usage-server" ;
3538
@@ -39,15 +42,17 @@ public class UsageServer {
3942 * @param args
4043 */
4144 public static void main (String [] args ) {
42- initLog4j ();
45+ initLog4j ();
4346 UsageServer usage = new UsageServer ();
44- usage .init (args );
4547 usage .start ();
4648 }
4749
48- public void init (String [] args ) {
50+ @ Override
51+ public void init (DaemonContext arg0 ) throws DaemonInitException , Exception {
52+ initLog4j ();
4953 }
5054
55+ @ Override
5156 public void start () {
5257 ApplicationContext appContext = new ClassPathXmlApplicationContext ("usageApplicationContext.xml" );
5358
@@ -66,10 +71,12 @@ public void start() {
6671 }
6772 }
6873
74+ @ Override
6975 public void stop () {
7076
7177 }
7278
79+ @ Override
7380 public void destroy () {
7481
7582 }
@@ -96,4 +103,5 @@ static private void initLog4j() {
96103 }
97104 }
98105 }
106+
99107}
You can’t perform that action at this time.
0 commit comments