2 Replies Latest reply on May 7, 2014 7:47 AM by Marco Simões

    Cannot start jboss service with crontab

    Marco Simões Newbie

      Hi guys.

      I want to restart my jboss every month, and i created a task on crontab to make this, but not works.


      The application stoped normally, but when started, one error occured on host controller and not logged for me.


      Anyone had this problem ?



        • 1. Re: Cannot start jboss service with crontab
          Wolf-Dieter Fink Master

          Could you post a bit more information how you do it and how the cron/srcipt look like?

          • 2. Re: Cannot start jboss service with crontab
            Marco Simões Newbie

            I got this message when i run crontab as root:


            Starting jboss-as: java.io.IOException: Cannot run program "java" (in directory "/root"): error=13, Permission denied

              at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)

              at org.jboss.as.process.ManagedProcess.doStart(ManagedProcess.java:199)

              at org.jboss.as.process.ManagedProcess.start(ManagedProcess.java:152)

              at org.jboss.as.process.ProcessController.startProcess(ProcessController.java:137)

              at org.jboss.as.process.Main.start(Main.java:231)

              at org.jboss.as.process.Main.main(Main.java:74)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.lang.reflect.Method.invoke(Method.java:601)

              at org.jboss.modules.Module.run(Module.java:270)

              at org.jboss.modules.Main.main(Main.java:411)

            Caused by: java.io.IOException: error=13, Permission denied

              at java.lang.UNIXProcess.forkAndExec(Native Method)

              at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)

              at java.lang.ProcessImpl.start(ProcessImpl.java:130)

              at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)

              ... 11 more



            In my crontab i put this:

            00 23 01 * * /root/restart-jboss-as.sh


            In my script i put this:


            /etc/init.d/jboss-as restart



            I resolved this problem runned crontab as a jboss user, and set the jboss users to not require tty on /etc/sudoers.