You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Craig Parker <cr...@fossfolks.com> on 2016/07/22 03:15:49 UTC

What am I missing? /etc/init.d type of start

I set this down because I couldn't get it running, but I'm picking it 
back up. Still in the "using the demo" stage,a nd while I can start fine 
with ./ant start from the ofbiz directory, I can't seem to get it 
started with an /etc/init.d/ofbiz script.
I've tried a couple things, but the latest (back to square 1) spot I'm 
in is copying ofbizdir/tools/rc.ofbiz /etc/init.d/ofbiz

Not sure what I read that told me this, but I commented out . 
/etc/rc.d/init.d/functions (in the vicinity of line 30) and . 
/etc/sysconfig/network near line 34, changed my path to /ofbiz (where I 
unzipped it) and also replaced any instances of echo_ with just echo  
(echo followed by a space).

So here's my script, and I can't get it running. Nor can I seem to find 
a log file anywhere that tells me what's going on. ofbiz owns the 
/etc/init.d/ofbiz , and I'm starting it as root with sudo -u ofbiz 
/etc/init.d/ofbiz restart

#!/bin/sh
#####################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
#####################################################################
#
# ofbiz        This shell script takes care of starting and stopping
#              the OFBiz subsystem
#
# chkconfig: - 80 10
# description: OFBiz server

# Source function library
# this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
# => comment out and use "echo failure" and "echo success" in place of 
echo failure and echo success (minor anyway)
#. /etc/rc.d/init.d/functions

# Source networking configuration
# this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
#. /etc/sysconfig/network

# Paths - Edit for your locations
JAVA_BINARY=/usr/bin/java
OFBIZ_HOME=/ofbiz
OFBIZ_LOG=$OFBIZ_HOME/runtime/logs/console.log

# VM Options
JAVA_VMOPTIONS="-Xms128M -Xmx512M -XX:MaxPermSize=512m"

# Java arguments
JAVA_ARGS="-jar ofbiz.jar"

# *nix user ofbiz should run as (you must create this user first)
OFBIZ_USER=ofbiz

# OFBiz processes running
ofbizprocs() {
     OFBIZ_PROCS=`/bin/ps h -o pid,args -C java | /bin/grep -e 
"$JAVA_ARGS" | /bin/egrep -o "^[[:space:]]*[[:digit:]]*"`
}

# Checking user...
checkuser() {
     if [ "$USER" != "$OFBIZ_USER" ]; then
         echo failure
         echo
         echo "Only users root or $OFBIZ_USER should start/stop the 
application"
         exit 1
     fi
}

# Start OFBiz
start() {
     echo -n "Starting OFBiz: "
     checkuser
     ofbizprocs
     if [ "$OFBIZ_PROCS" != "" ]; then
         echo failure
         echo
         echo "OFBiz is already running..."
         return 1
     fi

     # All clear
     cd $OFBIZ_HOME
     umask 007
     /bin/rm -f $OFBIZ_LOG
     $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS >>$OFBIZ_LOG 2>>$OFBIZ_LOG&
     echo success
     return 0
}

# Stop OFBiz
stop() {
     echo -n "Stopping OFBiz: "
     checkuser
     ofbizprocs
     if [ "$OFBIZ_PROCS" == "" ]; then
         echo failure
         echo
         echo "OFBiz is not running..."
         return 1
     fi

     # All clear
     cd $OFBIZ_HOME
     umask 007
     $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS -shutdown >>$OFBIZ_LOG
     ofbizprocs
     if [ "$OFBIZ_PROCS" != "" ]; then
         # Let's try to -TERM
         /bin/kill -TERM $OFBIZ_PROCS
     fi
     ofbizprocs
     if [ "$OFBIZ_PROCS" != "" ]; then
         # Let's try it the hard way!
         /bin/kill -9 $OFBIZ_PROCS
     fi
     ofbizprocs
     if [ "$OFBIZ_PROCS" != "" ]; then
         echo failure
         echo
         echo "Some processes could not be stopped:"
         echo $OFBIZ_PROCS
         echo "A possible solution is to try this command once more!"
         return 1
     else
         echo success
         return 0
     fi
}

# If root is running this script, su to $OFBIZ_USER first
# Note that under Debian/Ubuntu/etc. you should use instead
# if [ "$USER" = "root" ]; then
if [ "$UID" = "0" ]; then
     exec su - $OFBIZ_USER -c "$0 $1"
fi

case "$1" in
     'start')
         start
     ;;
     'stop')
         stop
     ;;
     'restart')
         stop
         start
     ;;
     'status')
         ofbizprocs
         if [ "$OFBIZ_PROCS" == "" ]; then
             echo "OFBiz is stopped"
             exit 1
         else
             echo "OFBiz is running"
             exit 0
         fi
     ;;
     *)
         echo "Usage: $0 {start|stop|kill|restart|status|help}"
         exit 1
     ;;
esac
echo
exit $?

Re: What am I missing? /etc/init.d type of start

Posted by Chris Clark <ri...@gmail.com>.
I only commented because it took me a while to get a init.d startup to
work, and as soon as I finished it, i upgraded my fedora box and now
everything is systemd.  Some people don't like the all powerful systemd,
but it is taking over nonetheless, much like selinux

Chris

On Jul 27, 2016 1:20 PM, "Craig Parker" <cr...@fossfolks.com> wrote:

> Welp... I guess that's the next step.
>
> On 07/27/2016 12:39 AM, Chris Clark wrote:
>
>> The real question is why you aren't on systemd by now
>>
>> Chris
>>
>> On Jul 26, 2016 9:33 PM, "Craig Parker" <cr...@fossfolks.com> wrote:
>>
>> Pierre -- it's up and running. Thanks a bunch. I need to get POS running
>>> too, but I'll take a break and just learn what I've got for the moment
>>>
>>> On 07/22/2016 12:01 PM, Pierre Smits wrote:
>>>
>>> Hi Craig,
>>>>
>>>> I have found that the script for Ubuntu is of a lesser quality than the
>>>> one
>>>> for Debian, so that is what I have been using for various environments
>>>> as
>>>> a
>>>> starting point.
>>>>
>>>> Best regards,
>>>>
>>>> Pierre Smits
>>>>
>>>> ORRTIZ.COM <http://www.orrtiz.com>
>>>> OFBiz based solutions & services
>>>>
>>>> OFBiz Extensions Marketplace
>>>> http://oem.ofbizci.net/oci-2/
>>>>
>>>> On Fri, Jul 22, 2016 at 5:09 PM, Craig Parker <cr...@fossfolks.com>
>>>> wrote:
>>>>
>>>> I'm on Ubuntu 14.04 server (32 bit -- this is just an old clunker
>>>> computer
>>>>
>>>>> I'm trying stuff out on) and the OFBIZ zip I grabbed is 13.07.03.
>>>>>
>>>>> There was an ubuntu script I tried grabbing instead of rc.ofbiz
>>>>> (rc.ofbiz.for.ubuntu) a couple months ago, but didn't have any better
>>>>> luck
>>>>> with that. I think I'm going to land on Debian eventually, but if I can
>>>>> troubleshoot this install I should be able to figure that one out.
>>>>>
>>>>>
>>>>> On 07/22/2016 02:24 AM, Pierre Smits wrote:
>>>>>
>>>>> Hi Craig,
>>>>>
>>>>>> May I ask what OS version you are using and what the version of OFBiz
>>>>>> is?
>>>>>>
>>>>>> Best regards,
>>>>>>
>>>>>> Pierre Smits
>>>>>>
>>>>>> ORRTIZ.COM <http://www.orrtiz.com>
>>>>>>
>>>>>> OFBiz based solutions & services
>>>>>>
>>>>>> OFBiz Extensions Marketplace
>>>>>> http://oem.ofbizci.net/oci-2/
>>>>>>
>>>>>> On Fri, Jul 22, 2016 at 5:15 AM, Craig Parker <cr...@fossfolks.com>
>>>>>> wrote:
>>>>>>
>>>>>> I set this down because I couldn't get it running, but I'm picking it
>>>>>> back
>>>>>>
>>>>>> up. Still in the "using the demo" stage,a nd while I can start fine
>>>>>>> with
>>>>>>> ./ant start from the ofbiz directory, I can't seem to get it started
>>>>>>> with
>>>>>>> an /etc/init.d/ofbiz script.
>>>>>>> I've tried a couple things, but the latest (back to square 1) spot
>>>>>>> I'm
>>>>>>> in
>>>>>>> is copying ofbizdir/tools/rc.ofbiz /etc/init.d/ofbiz
>>>>>>>
>>>>>>> Not sure what I read that told me this, but I commented out .
>>>>>>> /etc/rc.d/init.d/functions (in the vicinity of line 30) and .
>>>>>>> /etc/sysconfig/network near line 34, changed my path to /ofbiz
>>>>>>> (where I
>>>>>>> unzipped it) and also replaced any instances of echo_ with just echo
>>>>>>> (echo
>>>>>>> followed by a space).
>>>>>>>
>>>>>>> So here's my script, and I can't get it running. Nor can I seem to
>>>>>>> find a
>>>>>>> log file anywhere that tells me what's going on. ofbiz owns the
>>>>>>> /etc/init.d/ofbiz , and I'm starting it as root with sudo -u ofbiz
>>>>>>> /etc/init.d/ofbiz restart
>>>>>>>
>>>>>>> #!/bin/sh
>>>>>>> #####################################################################
>>>>>>> # Licensed to the Apache Software Foundation (ASF) under one
>>>>>>> # or more contributor license agreements.  See the NOTICE file
>>>>>>> # distributed with this work for additional information
>>>>>>> # regarding copyright ownership.  The ASF licenses this file
>>>>>>> # to you under the Apache License, Version 2.0 (the
>>>>>>> # "License"); you may not use this file except in compliance
>>>>>>> # with the License.  You may obtain a copy of the License at
>>>>>>> #
>>>>>>> # http://www.apache.org/licenses/LICENSE-2.0
>>>>>>> #
>>>>>>> # Unless required by applicable law or agreed to in writing,
>>>>>>> # software distributed under the License is distributed on an
>>>>>>> # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>>>>> # KIND, either express or implied.  See the License for the
>>>>>>> # specific language governing permissions and limitations
>>>>>>> # under the License.
>>>>>>> #####################################################################
>>>>>>> #
>>>>>>> # ofbiz        This shell script takes care of starting and stopping
>>>>>>> #              the OFBiz subsystem
>>>>>>> #
>>>>>>> # chkconfig: - 80 10
>>>>>>> # description: OFBiz server
>>>>>>>
>>>>>>> # Source function library
>>>>>>> # this does not exist in Debian/Ubuntu/etc. => see
>>>>>>> rc.ofbiz.for.debian
>>>>>>> # => comment out and use "echo failure" and "echo success" in place
>>>>>>> of
>>>>>>> echo failure and echo success (minor anyway)
>>>>>>> #. /etc/rc.d/init.d/functions
>>>>>>>
>>>>>>> # Source networking configuration
>>>>>>> # this does not exist in Debian/Ubuntu/etc. => see
>>>>>>> rc.ofbiz.for.debian
>>>>>>> #. /etc/sysconfig/network
>>>>>>>
>>>>>>> # Paths - Edit for your locations
>>>>>>> JAVA_BINARY=/usr/bin/java
>>>>>>> OFBIZ_HOME=/ofbiz
>>>>>>> OFBIZ_LOG=$OFBIZ_HOME/runtime/logs/console.log
>>>>>>>
>>>>>>> # VM Options
>>>>>>> JAVA_VMOPTIONS="-Xms128M -Xmx512M -XX:MaxPermSize=512m"
>>>>>>>
>>>>>>> # Java arguments
>>>>>>> JAVA_ARGS="-jar ofbiz.jar"
>>>>>>>
>>>>>>> # *nix user ofbiz should run as (you must create this user first)
>>>>>>> OFBIZ_USER=ofbiz
>>>>>>>
>>>>>>> # OFBiz processes running
>>>>>>> ofbizprocs() {
>>>>>>>        OFBIZ_PROCS=`/bin/ps h -o pid,args -C java | /bin/grep -e
>>>>>>> "$JAVA_ARGS"
>>>>>>> | /bin/egrep -o "^[[:space:]]*[[:digit:]]*"`
>>>>>>> }
>>>>>>>
>>>>>>> # Checking user...
>>>>>>> checkuser() {
>>>>>>>        if [ "$USER" != "$OFBIZ_USER" ]; then
>>>>>>>            echo failure
>>>>>>>            echo
>>>>>>>            echo "Only users root or $OFBIZ_USER should start/stop the
>>>>>>> application"
>>>>>>>            exit 1
>>>>>>>        fi
>>>>>>> }
>>>>>>>
>>>>>>> # Start OFBiz
>>>>>>> start() {
>>>>>>>        echo -n "Starting OFBiz: "
>>>>>>>        checkuser
>>>>>>>        ofbizprocs
>>>>>>>        if [ "$OFBIZ_PROCS" != "" ]; then
>>>>>>>            echo failure
>>>>>>>            echo
>>>>>>>            echo "OFBiz is already running..."
>>>>>>>            return 1
>>>>>>>        fi
>>>>>>>
>>>>>>>        # All clear
>>>>>>>        cd $OFBIZ_HOME
>>>>>>>        umask 007
>>>>>>>        /bin/rm -f $OFBIZ_LOG
>>>>>>>        $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS >>$OFBIZ_LOG
>>>>>>> 2>>$OFBIZ_LOG&
>>>>>>>        echo success
>>>>>>>        return 0
>>>>>>> }
>>>>>>>
>>>>>>> # Stop OFBiz
>>>>>>> stop() {
>>>>>>>        echo -n "Stopping OFBiz: "
>>>>>>>        checkuser
>>>>>>>        ofbizprocs
>>>>>>>        if [ "$OFBIZ_PROCS" == "" ]; then
>>>>>>>            echo failure
>>>>>>>            echo
>>>>>>>            echo "OFBiz is not running..."
>>>>>>>            return 1
>>>>>>>        fi
>>>>>>>
>>>>>>>        # All clear
>>>>>>>        cd $OFBIZ_HOME
>>>>>>>        umask 007
>>>>>>>        $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS -shutdown >>$OFBIZ_LOG
>>>>>>>        ofbizprocs
>>>>>>>        if [ "$OFBIZ_PROCS" != "" ]; then
>>>>>>>            # Let's try to -TERM
>>>>>>>            /bin/kill -TERM $OFBIZ_PROCS
>>>>>>>        fi
>>>>>>>        ofbizprocs
>>>>>>>        if [ "$OFBIZ_PROCS" != "" ]; then
>>>>>>>            # Let's try it the hard way!
>>>>>>>            /bin/kill -9 $OFBIZ_PROCS
>>>>>>>        fi
>>>>>>>        ofbizprocs
>>>>>>>        if [ "$OFBIZ_PROCS" != "" ]; then
>>>>>>>            echo failure
>>>>>>>            echo
>>>>>>>            echo "Some processes could not be stopped:"
>>>>>>>            echo $OFBIZ_PROCS
>>>>>>>            echo "A possible solution is to try this command once
>>>>>>> more!"
>>>>>>>            return 1
>>>>>>>        else
>>>>>>>            echo success
>>>>>>>            return 0
>>>>>>>        fi
>>>>>>> }
>>>>>>>
>>>>>>> # If root is running this script, su to $OFBIZ_USER first
>>>>>>> # Note that under Debian/Ubuntu/etc. you should use instead
>>>>>>> # if [ "$USER" = "root" ]; then
>>>>>>> if [ "$UID" = "0" ]; then
>>>>>>>        exec su - $OFBIZ_USER -c "$0 $1"
>>>>>>> fi
>>>>>>>
>>>>>>> case "$1" in
>>>>>>>        'start')
>>>>>>>            start
>>>>>>>        ;;
>>>>>>>        'stop')
>>>>>>>            stop
>>>>>>>        ;;
>>>>>>>        'restart')
>>>>>>>            stop
>>>>>>>            start
>>>>>>>        ;;
>>>>>>>        'status')
>>>>>>>            ofbizprocs
>>>>>>>            if [ "$OFBIZ_PROCS" == "" ]; then
>>>>>>>                echo "OFBiz is stopped"
>>>>>>>                exit 1
>>>>>>>            else
>>>>>>>                echo "OFBiz is running"
>>>>>>>                exit 0
>>>>>>>            fi
>>>>>>>        ;;
>>>>>>>        *)
>>>>>>>            echo "Usage: $0 {start|stop|kill|restart|status|help}"
>>>>>>>            exit 1
>>>>>>>        ;;
>>>>>>> esac
>>>>>>> echo
>>>>>>> exit $?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>

Re: What am I missing? /etc/init.d type of start

Posted by Craig Parker <cr...@fossfolks.com>.
Welp... I guess that's the next step.

On 07/27/2016 12:39 AM, Chris Clark wrote:
> The real question is why you aren't on systemd by now
>
> Chris
>
> On Jul 26, 2016 9:33 PM, "Craig Parker" <cr...@fossfolks.com> wrote:
>
>> Pierre -- it's up and running. Thanks a bunch. I need to get POS running
>> too, but I'll take a break and just learn what I've got for the moment
>>
>> On 07/22/2016 12:01 PM, Pierre Smits wrote:
>>
>>> Hi Craig,
>>>
>>> I have found that the script for Ubuntu is of a lesser quality than the
>>> one
>>> for Debian, so that is what I have been using for various environments as
>>> a
>>> starting point.
>>>
>>> Best regards,
>>>
>>> Pierre Smits
>>>
>>> ORRTIZ.COM <http://www.orrtiz.com>
>>> OFBiz based solutions & services
>>>
>>> OFBiz Extensions Marketplace
>>> http://oem.ofbizci.net/oci-2/
>>>
>>> On Fri, Jul 22, 2016 at 5:09 PM, Craig Parker <cr...@fossfolks.com>
>>> wrote:
>>>
>>> I'm on Ubuntu 14.04 server (32 bit -- this is just an old clunker computer
>>>> I'm trying stuff out on) and the OFBIZ zip I grabbed is 13.07.03.
>>>>
>>>> There was an ubuntu script I tried grabbing instead of rc.ofbiz
>>>> (rc.ofbiz.for.ubuntu) a couple months ago, but didn't have any better
>>>> luck
>>>> with that. I think I'm going to land on Debian eventually, but if I can
>>>> troubleshoot this install I should be able to figure that one out.
>>>>
>>>>
>>>> On 07/22/2016 02:24 AM, Pierre Smits wrote:
>>>>
>>>> Hi Craig,
>>>>> May I ask what OS version you are using and what the version of OFBiz
>>>>> is?
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Pierre Smits
>>>>>
>>>>> ORRTIZ.COM <http://www.orrtiz.com>
>>>>>
>>>>> OFBiz based solutions & services
>>>>>
>>>>> OFBiz Extensions Marketplace
>>>>> http://oem.ofbizci.net/oci-2/
>>>>>
>>>>> On Fri, Jul 22, 2016 at 5:15 AM, Craig Parker <cr...@fossfolks.com>
>>>>> wrote:
>>>>>
>>>>> I set this down because I couldn't get it running, but I'm picking it
>>>>> back
>>>>>
>>>>>> up. Still in the "using the demo" stage,a nd while I can start fine
>>>>>> with
>>>>>> ./ant start from the ofbiz directory, I can't seem to get it started
>>>>>> with
>>>>>> an /etc/init.d/ofbiz script.
>>>>>> I've tried a couple things, but the latest (back to square 1) spot I'm
>>>>>> in
>>>>>> is copying ofbizdir/tools/rc.ofbiz /etc/init.d/ofbiz
>>>>>>
>>>>>> Not sure what I read that told me this, but I commented out .
>>>>>> /etc/rc.d/init.d/functions (in the vicinity of line 30) and .
>>>>>> /etc/sysconfig/network near line 34, changed my path to /ofbiz (where I
>>>>>> unzipped it) and also replaced any instances of echo_ with just echo
>>>>>> (echo
>>>>>> followed by a space).
>>>>>>
>>>>>> So here's my script, and I can't get it running. Nor can I seem to
>>>>>> find a
>>>>>> log file anywhere that tells me what's going on. ofbiz owns the
>>>>>> /etc/init.d/ofbiz , and I'm starting it as root with sudo -u ofbiz
>>>>>> /etc/init.d/ofbiz restart
>>>>>>
>>>>>> #!/bin/sh
>>>>>> #####################################################################
>>>>>> # Licensed to the Apache Software Foundation (ASF) under one
>>>>>> # or more contributor license agreements.  See the NOTICE file
>>>>>> # distributed with this work for additional information
>>>>>> # regarding copyright ownership.  The ASF licenses this file
>>>>>> # to you under the Apache License, Version 2.0 (the
>>>>>> # "License"); you may not use this file except in compliance
>>>>>> # with the License.  You may obtain a copy of the License at
>>>>>> #
>>>>>> # http://www.apache.org/licenses/LICENSE-2.0
>>>>>> #
>>>>>> # Unless required by applicable law or agreed to in writing,
>>>>>> # software distributed under the License is distributed on an
>>>>>> # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>>>> # KIND, either express or implied.  See the License for the
>>>>>> # specific language governing permissions and limitations
>>>>>> # under the License.
>>>>>> #####################################################################
>>>>>> #
>>>>>> # ofbiz        This shell script takes care of starting and stopping
>>>>>> #              the OFBiz subsystem
>>>>>> #
>>>>>> # chkconfig: - 80 10
>>>>>> # description: OFBiz server
>>>>>>
>>>>>> # Source function library
>>>>>> # this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
>>>>>> # => comment out and use "echo failure" and "echo success" in place of
>>>>>> echo failure and echo success (minor anyway)
>>>>>> #. /etc/rc.d/init.d/functions
>>>>>>
>>>>>> # Source networking configuration
>>>>>> # this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
>>>>>> #. /etc/sysconfig/network
>>>>>>
>>>>>> # Paths - Edit for your locations
>>>>>> JAVA_BINARY=/usr/bin/java
>>>>>> OFBIZ_HOME=/ofbiz
>>>>>> OFBIZ_LOG=$OFBIZ_HOME/runtime/logs/console.log
>>>>>>
>>>>>> # VM Options
>>>>>> JAVA_VMOPTIONS="-Xms128M -Xmx512M -XX:MaxPermSize=512m"
>>>>>>
>>>>>> # Java arguments
>>>>>> JAVA_ARGS="-jar ofbiz.jar"
>>>>>>
>>>>>> # *nix user ofbiz should run as (you must create this user first)
>>>>>> OFBIZ_USER=ofbiz
>>>>>>
>>>>>> # OFBiz processes running
>>>>>> ofbizprocs() {
>>>>>>        OFBIZ_PROCS=`/bin/ps h -o pid,args -C java | /bin/grep -e
>>>>>> "$JAVA_ARGS"
>>>>>> | /bin/egrep -o "^[[:space:]]*[[:digit:]]*"`
>>>>>> }
>>>>>>
>>>>>> # Checking user...
>>>>>> checkuser() {
>>>>>>        if [ "$USER" != "$OFBIZ_USER" ]; then
>>>>>>            echo failure
>>>>>>            echo
>>>>>>            echo "Only users root or $OFBIZ_USER should start/stop the
>>>>>> application"
>>>>>>            exit 1
>>>>>>        fi
>>>>>> }
>>>>>>
>>>>>> # Start OFBiz
>>>>>> start() {
>>>>>>        echo -n "Starting OFBiz: "
>>>>>>        checkuser
>>>>>>        ofbizprocs
>>>>>>        if [ "$OFBIZ_PROCS" != "" ]; then
>>>>>>            echo failure
>>>>>>            echo
>>>>>>            echo "OFBiz is already running..."
>>>>>>            return 1
>>>>>>        fi
>>>>>>
>>>>>>        # All clear
>>>>>>        cd $OFBIZ_HOME
>>>>>>        umask 007
>>>>>>        /bin/rm -f $OFBIZ_LOG
>>>>>>        $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS >>$OFBIZ_LOG
>>>>>> 2>>$OFBIZ_LOG&
>>>>>>        echo success
>>>>>>        return 0
>>>>>> }
>>>>>>
>>>>>> # Stop OFBiz
>>>>>> stop() {
>>>>>>        echo -n "Stopping OFBiz: "
>>>>>>        checkuser
>>>>>>        ofbizprocs
>>>>>>        if [ "$OFBIZ_PROCS" == "" ]; then
>>>>>>            echo failure
>>>>>>            echo
>>>>>>            echo "OFBiz is not running..."
>>>>>>            return 1
>>>>>>        fi
>>>>>>
>>>>>>        # All clear
>>>>>>        cd $OFBIZ_HOME
>>>>>>        umask 007
>>>>>>        $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS -shutdown >>$OFBIZ_LOG
>>>>>>        ofbizprocs
>>>>>>        if [ "$OFBIZ_PROCS" != "" ]; then
>>>>>>            # Let's try to -TERM
>>>>>>            /bin/kill -TERM $OFBIZ_PROCS
>>>>>>        fi
>>>>>>        ofbizprocs
>>>>>>        if [ "$OFBIZ_PROCS" != "" ]; then
>>>>>>            # Let's try it the hard way!
>>>>>>            /bin/kill -9 $OFBIZ_PROCS
>>>>>>        fi
>>>>>>        ofbizprocs
>>>>>>        if [ "$OFBIZ_PROCS" != "" ]; then
>>>>>>            echo failure
>>>>>>            echo
>>>>>>            echo "Some processes could not be stopped:"
>>>>>>            echo $OFBIZ_PROCS
>>>>>>            echo "A possible solution is to try this command once more!"
>>>>>>            return 1
>>>>>>        else
>>>>>>            echo success
>>>>>>            return 0
>>>>>>        fi
>>>>>> }
>>>>>>
>>>>>> # If root is running this script, su to $OFBIZ_USER first
>>>>>> # Note that under Debian/Ubuntu/etc. you should use instead
>>>>>> # if [ "$USER" = "root" ]; then
>>>>>> if [ "$UID" = "0" ]; then
>>>>>>        exec su - $OFBIZ_USER -c "$0 $1"
>>>>>> fi
>>>>>>
>>>>>> case "$1" in
>>>>>>        'start')
>>>>>>            start
>>>>>>        ;;
>>>>>>        'stop')
>>>>>>            stop
>>>>>>        ;;
>>>>>>        'restart')
>>>>>>            stop
>>>>>>            start
>>>>>>        ;;
>>>>>>        'status')
>>>>>>            ofbizprocs
>>>>>>            if [ "$OFBIZ_PROCS" == "" ]; then
>>>>>>                echo "OFBiz is stopped"
>>>>>>                exit 1
>>>>>>            else
>>>>>>                echo "OFBiz is running"
>>>>>>                exit 0
>>>>>>            fi
>>>>>>        ;;
>>>>>>        *)
>>>>>>            echo "Usage: $0 {start|stop|kill|restart|status|help}"
>>>>>>            exit 1
>>>>>>        ;;
>>>>>> esac
>>>>>> echo
>>>>>> exit $?
>>>>>>
>>>>>>
>>>>>>


Re: What am I missing? /etc/init.d type of start

Posted by Chris Clark <ri...@gmail.com>.
The real question is why you aren't on systemd by now

Chris

On Jul 26, 2016 9:33 PM, "Craig Parker" <cr...@fossfolks.com> wrote:

> Pierre -- it's up and running. Thanks a bunch. I need to get POS running
> too, but I'll take a break and just learn what I've got for the moment
>
> On 07/22/2016 12:01 PM, Pierre Smits wrote:
>
>> Hi Craig,
>>
>> I have found that the script for Ubuntu is of a lesser quality than the
>> one
>> for Debian, so that is what I have been using for various environments as
>> a
>> starting point.
>>
>> Best regards,
>>
>> Pierre Smits
>>
>> ORRTIZ.COM <http://www.orrtiz.com>
>> OFBiz based solutions & services
>>
>> OFBiz Extensions Marketplace
>> http://oem.ofbizci.net/oci-2/
>>
>> On Fri, Jul 22, 2016 at 5:09 PM, Craig Parker <cr...@fossfolks.com>
>> wrote:
>>
>> I'm on Ubuntu 14.04 server (32 bit -- this is just an old clunker computer
>>> I'm trying stuff out on) and the OFBIZ zip I grabbed is 13.07.03.
>>>
>>> There was an ubuntu script I tried grabbing instead of rc.ofbiz
>>> (rc.ofbiz.for.ubuntu) a couple months ago, but didn't have any better
>>> luck
>>> with that. I think I'm going to land on Debian eventually, but if I can
>>> troubleshoot this install I should be able to figure that one out.
>>>
>>>
>>> On 07/22/2016 02:24 AM, Pierre Smits wrote:
>>>
>>> Hi Craig,
>>>>
>>>> May I ask what OS version you are using and what the version of OFBiz
>>>> is?
>>>>
>>>> Best regards,
>>>>
>>>> Pierre Smits
>>>>
>>>> ORRTIZ.COM <http://www.orrtiz.com>
>>>>
>>>> OFBiz based solutions & services
>>>>
>>>> OFBiz Extensions Marketplace
>>>> http://oem.ofbizci.net/oci-2/
>>>>
>>>> On Fri, Jul 22, 2016 at 5:15 AM, Craig Parker <cr...@fossfolks.com>
>>>> wrote:
>>>>
>>>> I set this down because I couldn't get it running, but I'm picking it
>>>> back
>>>>
>>>>> up. Still in the "using the demo" stage,a nd while I can start fine
>>>>> with
>>>>> ./ant start from the ofbiz directory, I can't seem to get it started
>>>>> with
>>>>> an /etc/init.d/ofbiz script.
>>>>> I've tried a couple things, but the latest (back to square 1) spot I'm
>>>>> in
>>>>> is copying ofbizdir/tools/rc.ofbiz /etc/init.d/ofbiz
>>>>>
>>>>> Not sure what I read that told me this, but I commented out .
>>>>> /etc/rc.d/init.d/functions (in the vicinity of line 30) and .
>>>>> /etc/sysconfig/network near line 34, changed my path to /ofbiz (where I
>>>>> unzipped it) and also replaced any instances of echo_ with just echo
>>>>> (echo
>>>>> followed by a space).
>>>>>
>>>>> So here's my script, and I can't get it running. Nor can I seem to
>>>>> find a
>>>>> log file anywhere that tells me what's going on. ofbiz owns the
>>>>> /etc/init.d/ofbiz , and I'm starting it as root with sudo -u ofbiz
>>>>> /etc/init.d/ofbiz restart
>>>>>
>>>>> #!/bin/sh
>>>>> #####################################################################
>>>>> # Licensed to the Apache Software Foundation (ASF) under one
>>>>> # or more contributor license agreements.  See the NOTICE file
>>>>> # distributed with this work for additional information
>>>>> # regarding copyright ownership.  The ASF licenses this file
>>>>> # to you under the Apache License, Version 2.0 (the
>>>>> # "License"); you may not use this file except in compliance
>>>>> # with the License.  You may obtain a copy of the License at
>>>>> #
>>>>> # http://www.apache.org/licenses/LICENSE-2.0
>>>>> #
>>>>> # Unless required by applicable law or agreed to in writing,
>>>>> # software distributed under the License is distributed on an
>>>>> # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>>> # KIND, either express or implied.  See the License for the
>>>>> # specific language governing permissions and limitations
>>>>> # under the License.
>>>>> #####################################################################
>>>>> #
>>>>> # ofbiz        This shell script takes care of starting and stopping
>>>>> #              the OFBiz subsystem
>>>>> #
>>>>> # chkconfig: - 80 10
>>>>> # description: OFBiz server
>>>>>
>>>>> # Source function library
>>>>> # this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
>>>>> # => comment out and use "echo failure" and "echo success" in place of
>>>>> echo failure and echo success (minor anyway)
>>>>> #. /etc/rc.d/init.d/functions
>>>>>
>>>>> # Source networking configuration
>>>>> # this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
>>>>> #. /etc/sysconfig/network
>>>>>
>>>>> # Paths - Edit for your locations
>>>>> JAVA_BINARY=/usr/bin/java
>>>>> OFBIZ_HOME=/ofbiz
>>>>> OFBIZ_LOG=$OFBIZ_HOME/runtime/logs/console.log
>>>>>
>>>>> # VM Options
>>>>> JAVA_VMOPTIONS="-Xms128M -Xmx512M -XX:MaxPermSize=512m"
>>>>>
>>>>> # Java arguments
>>>>> JAVA_ARGS="-jar ofbiz.jar"
>>>>>
>>>>> # *nix user ofbiz should run as (you must create this user first)
>>>>> OFBIZ_USER=ofbiz
>>>>>
>>>>> # OFBiz processes running
>>>>> ofbizprocs() {
>>>>>       OFBIZ_PROCS=`/bin/ps h -o pid,args -C java | /bin/grep -e
>>>>> "$JAVA_ARGS"
>>>>> | /bin/egrep -o "^[[:space:]]*[[:digit:]]*"`
>>>>> }
>>>>>
>>>>> # Checking user...
>>>>> checkuser() {
>>>>>       if [ "$USER" != "$OFBIZ_USER" ]; then
>>>>>           echo failure
>>>>>           echo
>>>>>           echo "Only users root or $OFBIZ_USER should start/stop the
>>>>> application"
>>>>>           exit 1
>>>>>       fi
>>>>> }
>>>>>
>>>>> # Start OFBiz
>>>>> start() {
>>>>>       echo -n "Starting OFBiz: "
>>>>>       checkuser
>>>>>       ofbizprocs
>>>>>       if [ "$OFBIZ_PROCS" != "" ]; then
>>>>>           echo failure
>>>>>           echo
>>>>>           echo "OFBiz is already running..."
>>>>>           return 1
>>>>>       fi
>>>>>
>>>>>       # All clear
>>>>>       cd $OFBIZ_HOME
>>>>>       umask 007
>>>>>       /bin/rm -f $OFBIZ_LOG
>>>>>       $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS >>$OFBIZ_LOG
>>>>> 2>>$OFBIZ_LOG&
>>>>>       echo success
>>>>>       return 0
>>>>> }
>>>>>
>>>>> # Stop OFBiz
>>>>> stop() {
>>>>>       echo -n "Stopping OFBiz: "
>>>>>       checkuser
>>>>>       ofbizprocs
>>>>>       if [ "$OFBIZ_PROCS" == "" ]; then
>>>>>           echo failure
>>>>>           echo
>>>>>           echo "OFBiz is not running..."
>>>>>           return 1
>>>>>       fi
>>>>>
>>>>>       # All clear
>>>>>       cd $OFBIZ_HOME
>>>>>       umask 007
>>>>>       $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS -shutdown >>$OFBIZ_LOG
>>>>>       ofbizprocs
>>>>>       if [ "$OFBIZ_PROCS" != "" ]; then
>>>>>           # Let's try to -TERM
>>>>>           /bin/kill -TERM $OFBIZ_PROCS
>>>>>       fi
>>>>>       ofbizprocs
>>>>>       if [ "$OFBIZ_PROCS" != "" ]; then
>>>>>           # Let's try it the hard way!
>>>>>           /bin/kill -9 $OFBIZ_PROCS
>>>>>       fi
>>>>>       ofbizprocs
>>>>>       if [ "$OFBIZ_PROCS" != "" ]; then
>>>>>           echo failure
>>>>>           echo
>>>>>           echo "Some processes could not be stopped:"
>>>>>           echo $OFBIZ_PROCS
>>>>>           echo "A possible solution is to try this command once more!"
>>>>>           return 1
>>>>>       else
>>>>>           echo success
>>>>>           return 0
>>>>>       fi
>>>>> }
>>>>>
>>>>> # If root is running this script, su to $OFBIZ_USER first
>>>>> # Note that under Debian/Ubuntu/etc. you should use instead
>>>>> # if [ "$USER" = "root" ]; then
>>>>> if [ "$UID" = "0" ]; then
>>>>>       exec su - $OFBIZ_USER -c "$0 $1"
>>>>> fi
>>>>>
>>>>> case "$1" in
>>>>>       'start')
>>>>>           start
>>>>>       ;;
>>>>>       'stop')
>>>>>           stop
>>>>>       ;;
>>>>>       'restart')
>>>>>           stop
>>>>>           start
>>>>>       ;;
>>>>>       'status')
>>>>>           ofbizprocs
>>>>>           if [ "$OFBIZ_PROCS" == "" ]; then
>>>>>               echo "OFBiz is stopped"
>>>>>               exit 1
>>>>>           else
>>>>>               echo "OFBiz is running"
>>>>>               exit 0
>>>>>           fi
>>>>>       ;;
>>>>>       *)
>>>>>           echo "Usage: $0 {start|stop|kill|restart|status|help}"
>>>>>           exit 1
>>>>>       ;;
>>>>> esac
>>>>> echo
>>>>> exit $?
>>>>>
>>>>>
>>>>>
>

Re: What am I missing? /etc/init.d type of start

Posted by Craig Parker <cr...@fossfolks.com>.
Pierre -- it's up and running. Thanks a bunch. I need to get POS running 
too, but I'll take a break and just learn what I've got for the moment

On 07/22/2016 12:01 PM, Pierre Smits wrote:
> Hi Craig,
>
> I have found that the script for Ubuntu is of a lesser quality than the one
> for Debian, so that is what I have been using for various environments as a
> starting point.
>
> Best regards,
>
> Pierre Smits
>
> ORRTIZ.COM <http://www.orrtiz.com>
> OFBiz based solutions & services
>
> OFBiz Extensions Marketplace
> http://oem.ofbizci.net/oci-2/
>
> On Fri, Jul 22, 2016 at 5:09 PM, Craig Parker <cr...@fossfolks.com> wrote:
>
>> I'm on Ubuntu 14.04 server (32 bit -- this is just an old clunker computer
>> I'm trying stuff out on) and the OFBIZ zip I grabbed is 13.07.03.
>>
>> There was an ubuntu script I tried grabbing instead of rc.ofbiz
>> (rc.ofbiz.for.ubuntu) a couple months ago, but didn't have any better luck
>> with that. I think I'm going to land on Debian eventually, but if I can
>> troubleshoot this install I should be able to figure that one out.
>>
>>
>> On 07/22/2016 02:24 AM, Pierre Smits wrote:
>>
>>> Hi Craig,
>>>
>>> May I ask what OS version you are using and what the version of OFBiz is?
>>>
>>> Best regards,
>>>
>>> Pierre Smits
>>>
>>> ORRTIZ.COM <http://www.orrtiz.com>
>>>
>>> OFBiz based solutions & services
>>>
>>> OFBiz Extensions Marketplace
>>> http://oem.ofbizci.net/oci-2/
>>>
>>> On Fri, Jul 22, 2016 at 5:15 AM, Craig Parker <cr...@fossfolks.com>
>>> wrote:
>>>
>>> I set this down because I couldn't get it running, but I'm picking it back
>>>> up. Still in the "using the demo" stage,a nd while I can start fine with
>>>> ./ant start from the ofbiz directory, I can't seem to get it started with
>>>> an /etc/init.d/ofbiz script.
>>>> I've tried a couple things, but the latest (back to square 1) spot I'm in
>>>> is copying ofbizdir/tools/rc.ofbiz /etc/init.d/ofbiz
>>>>
>>>> Not sure what I read that told me this, but I commented out .
>>>> /etc/rc.d/init.d/functions (in the vicinity of line 30) and .
>>>> /etc/sysconfig/network near line 34, changed my path to /ofbiz (where I
>>>> unzipped it) and also replaced any instances of echo_ with just echo
>>>> (echo
>>>> followed by a space).
>>>>
>>>> So here's my script, and I can't get it running. Nor can I seem to find a
>>>> log file anywhere that tells me what's going on. ofbiz owns the
>>>> /etc/init.d/ofbiz , and I'm starting it as root with sudo -u ofbiz
>>>> /etc/init.d/ofbiz restart
>>>>
>>>> #!/bin/sh
>>>> #####################################################################
>>>> # Licensed to the Apache Software Foundation (ASF) under one
>>>> # or more contributor license agreements.  See the NOTICE file
>>>> # distributed with this work for additional information
>>>> # regarding copyright ownership.  The ASF licenses this file
>>>> # to you under the Apache License, Version 2.0 (the
>>>> # "License"); you may not use this file except in compliance
>>>> # with the License.  You may obtain a copy of the License at
>>>> #
>>>> # http://www.apache.org/licenses/LICENSE-2.0
>>>> #
>>>> # Unless required by applicable law or agreed to in writing,
>>>> # software distributed under the License is distributed on an
>>>> # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> # KIND, either express or implied.  See the License for the
>>>> # specific language governing permissions and limitations
>>>> # under the License.
>>>> #####################################################################
>>>> #
>>>> # ofbiz        This shell script takes care of starting and stopping
>>>> #              the OFBiz subsystem
>>>> #
>>>> # chkconfig: - 80 10
>>>> # description: OFBiz server
>>>>
>>>> # Source function library
>>>> # this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
>>>> # => comment out and use "echo failure" and "echo success" in place of
>>>> echo failure and echo success (minor anyway)
>>>> #. /etc/rc.d/init.d/functions
>>>>
>>>> # Source networking configuration
>>>> # this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
>>>> #. /etc/sysconfig/network
>>>>
>>>> # Paths - Edit for your locations
>>>> JAVA_BINARY=/usr/bin/java
>>>> OFBIZ_HOME=/ofbiz
>>>> OFBIZ_LOG=$OFBIZ_HOME/runtime/logs/console.log
>>>>
>>>> # VM Options
>>>> JAVA_VMOPTIONS="-Xms128M -Xmx512M -XX:MaxPermSize=512m"
>>>>
>>>> # Java arguments
>>>> JAVA_ARGS="-jar ofbiz.jar"
>>>>
>>>> # *nix user ofbiz should run as (you must create this user first)
>>>> OFBIZ_USER=ofbiz
>>>>
>>>> # OFBiz processes running
>>>> ofbizprocs() {
>>>>       OFBIZ_PROCS=`/bin/ps h -o pid,args -C java | /bin/grep -e
>>>> "$JAVA_ARGS"
>>>> | /bin/egrep -o "^[[:space:]]*[[:digit:]]*"`
>>>> }
>>>>
>>>> # Checking user...
>>>> checkuser() {
>>>>       if [ "$USER" != "$OFBIZ_USER" ]; then
>>>>           echo failure
>>>>           echo
>>>>           echo "Only users root or $OFBIZ_USER should start/stop the
>>>> application"
>>>>           exit 1
>>>>       fi
>>>> }
>>>>
>>>> # Start OFBiz
>>>> start() {
>>>>       echo -n "Starting OFBiz: "
>>>>       checkuser
>>>>       ofbizprocs
>>>>       if [ "$OFBIZ_PROCS" != "" ]; then
>>>>           echo failure
>>>>           echo
>>>>           echo "OFBiz is already running..."
>>>>           return 1
>>>>       fi
>>>>
>>>>       # All clear
>>>>       cd $OFBIZ_HOME
>>>>       umask 007
>>>>       /bin/rm -f $OFBIZ_LOG
>>>>       $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS >>$OFBIZ_LOG 2>>$OFBIZ_LOG&
>>>>       echo success
>>>>       return 0
>>>> }
>>>>
>>>> # Stop OFBiz
>>>> stop() {
>>>>       echo -n "Stopping OFBiz: "
>>>>       checkuser
>>>>       ofbizprocs
>>>>       if [ "$OFBIZ_PROCS" == "" ]; then
>>>>           echo failure
>>>>           echo
>>>>           echo "OFBiz is not running..."
>>>>           return 1
>>>>       fi
>>>>
>>>>       # All clear
>>>>       cd $OFBIZ_HOME
>>>>       umask 007
>>>>       $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS -shutdown >>$OFBIZ_LOG
>>>>       ofbizprocs
>>>>       if [ "$OFBIZ_PROCS" != "" ]; then
>>>>           # Let's try to -TERM
>>>>           /bin/kill -TERM $OFBIZ_PROCS
>>>>       fi
>>>>       ofbizprocs
>>>>       if [ "$OFBIZ_PROCS" != "" ]; then
>>>>           # Let's try it the hard way!
>>>>           /bin/kill -9 $OFBIZ_PROCS
>>>>       fi
>>>>       ofbizprocs
>>>>       if [ "$OFBIZ_PROCS" != "" ]; then
>>>>           echo failure
>>>>           echo
>>>>           echo "Some processes could not be stopped:"
>>>>           echo $OFBIZ_PROCS
>>>>           echo "A possible solution is to try this command once more!"
>>>>           return 1
>>>>       else
>>>>           echo success
>>>>           return 0
>>>>       fi
>>>> }
>>>>
>>>> # If root is running this script, su to $OFBIZ_USER first
>>>> # Note that under Debian/Ubuntu/etc. you should use instead
>>>> # if [ "$USER" = "root" ]; then
>>>> if [ "$UID" = "0" ]; then
>>>>       exec su - $OFBIZ_USER -c "$0 $1"
>>>> fi
>>>>
>>>> case "$1" in
>>>>       'start')
>>>>           start
>>>>       ;;
>>>>       'stop')
>>>>           stop
>>>>       ;;
>>>>       'restart')
>>>>           stop
>>>>           start
>>>>       ;;
>>>>       'status')
>>>>           ofbizprocs
>>>>           if [ "$OFBIZ_PROCS" == "" ]; then
>>>>               echo "OFBiz is stopped"
>>>>               exit 1
>>>>           else
>>>>               echo "OFBiz is running"
>>>>               exit 0
>>>>           fi
>>>>       ;;
>>>>       *)
>>>>           echo "Usage: $0 {start|stop|kill|restart|status|help}"
>>>>           exit 1
>>>>       ;;
>>>> esac
>>>> echo
>>>> exit $?
>>>>
>>>>


Re: What am I missing? /etc/init.d type of start

Posted by Pierre Smits <pi...@gmail.com>.
Hi Craig,

I have found that the script for Ubuntu is of a lesser quality than the one
for Debian, so that is what I have been using for various environments as a
starting point.

Best regards,

Pierre Smits

ORRTIZ.COM <http://www.orrtiz.com>
OFBiz based solutions & services

OFBiz Extensions Marketplace
http://oem.ofbizci.net/oci-2/

On Fri, Jul 22, 2016 at 5:09 PM, Craig Parker <cr...@fossfolks.com> wrote:

> I'm on Ubuntu 14.04 server (32 bit -- this is just an old clunker computer
> I'm trying stuff out on) and the OFBIZ zip I grabbed is 13.07.03.
>
> There was an ubuntu script I tried grabbing instead of rc.ofbiz
> (rc.ofbiz.for.ubuntu) a couple months ago, but didn't have any better luck
> with that. I think I'm going to land on Debian eventually, but if I can
> troubleshoot this install I should be able to figure that one out.
>
>
> On 07/22/2016 02:24 AM, Pierre Smits wrote:
>
>> Hi Craig,
>>
>> May I ask what OS version you are using and what the version of OFBiz is?
>>
>> Best regards,
>>
>> Pierre Smits
>>
>> ORRTIZ.COM <http://www.orrtiz.com>
>>
>> OFBiz based solutions & services
>>
>> OFBiz Extensions Marketplace
>> http://oem.ofbizci.net/oci-2/
>>
>> On Fri, Jul 22, 2016 at 5:15 AM, Craig Parker <cr...@fossfolks.com>
>> wrote:
>>
>> I set this down because I couldn't get it running, but I'm picking it back
>>> up. Still in the "using the demo" stage,a nd while I can start fine with
>>> ./ant start from the ofbiz directory, I can't seem to get it started with
>>> an /etc/init.d/ofbiz script.
>>> I've tried a couple things, but the latest (back to square 1) spot I'm in
>>> is copying ofbizdir/tools/rc.ofbiz /etc/init.d/ofbiz
>>>
>>> Not sure what I read that told me this, but I commented out .
>>> /etc/rc.d/init.d/functions (in the vicinity of line 30) and .
>>> /etc/sysconfig/network near line 34, changed my path to /ofbiz (where I
>>> unzipped it) and also replaced any instances of echo_ with just echo
>>> (echo
>>> followed by a space).
>>>
>>> So here's my script, and I can't get it running. Nor can I seem to find a
>>> log file anywhere that tells me what's going on. ofbiz owns the
>>> /etc/init.d/ofbiz , and I'm starting it as root with sudo -u ofbiz
>>> /etc/init.d/ofbiz restart
>>>
>>> #!/bin/sh
>>> #####################################################################
>>> # Licensed to the Apache Software Foundation (ASF) under one
>>> # or more contributor license agreements.  See the NOTICE file
>>> # distributed with this work for additional information
>>> # regarding copyright ownership.  The ASF licenses this file
>>> # to you under the Apache License, Version 2.0 (the
>>> # "License"); you may not use this file except in compliance
>>> # with the License.  You may obtain a copy of the License at
>>> #
>>> # http://www.apache.org/licenses/LICENSE-2.0
>>> #
>>> # Unless required by applicable law or agreed to in writing,
>>> # software distributed under the License is distributed on an
>>> # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> # KIND, either express or implied.  See the License for the
>>> # specific language governing permissions and limitations
>>> # under the License.
>>> #####################################################################
>>> #
>>> # ofbiz        This shell script takes care of starting and stopping
>>> #              the OFBiz subsystem
>>> #
>>> # chkconfig: - 80 10
>>> # description: OFBiz server
>>>
>>> # Source function library
>>> # this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
>>> # => comment out and use "echo failure" and "echo success" in place of
>>> echo failure and echo success (minor anyway)
>>> #. /etc/rc.d/init.d/functions
>>>
>>> # Source networking configuration
>>> # this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
>>> #. /etc/sysconfig/network
>>>
>>> # Paths - Edit for your locations
>>> JAVA_BINARY=/usr/bin/java
>>> OFBIZ_HOME=/ofbiz
>>> OFBIZ_LOG=$OFBIZ_HOME/runtime/logs/console.log
>>>
>>> # VM Options
>>> JAVA_VMOPTIONS="-Xms128M -Xmx512M -XX:MaxPermSize=512m"
>>>
>>> # Java arguments
>>> JAVA_ARGS="-jar ofbiz.jar"
>>>
>>> # *nix user ofbiz should run as (you must create this user first)
>>> OFBIZ_USER=ofbiz
>>>
>>> # OFBiz processes running
>>> ofbizprocs() {
>>>      OFBIZ_PROCS=`/bin/ps h -o pid,args -C java | /bin/grep -e
>>> "$JAVA_ARGS"
>>> | /bin/egrep -o "^[[:space:]]*[[:digit:]]*"`
>>> }
>>>
>>> # Checking user...
>>> checkuser() {
>>>      if [ "$USER" != "$OFBIZ_USER" ]; then
>>>          echo failure
>>>          echo
>>>          echo "Only users root or $OFBIZ_USER should start/stop the
>>> application"
>>>          exit 1
>>>      fi
>>> }
>>>
>>> # Start OFBiz
>>> start() {
>>>      echo -n "Starting OFBiz: "
>>>      checkuser
>>>      ofbizprocs
>>>      if [ "$OFBIZ_PROCS" != "" ]; then
>>>          echo failure
>>>          echo
>>>          echo "OFBiz is already running..."
>>>          return 1
>>>      fi
>>>
>>>      # All clear
>>>      cd $OFBIZ_HOME
>>>      umask 007
>>>      /bin/rm -f $OFBIZ_LOG
>>>      $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS >>$OFBIZ_LOG 2>>$OFBIZ_LOG&
>>>      echo success
>>>      return 0
>>> }
>>>
>>> # Stop OFBiz
>>> stop() {
>>>      echo -n "Stopping OFBiz: "
>>>      checkuser
>>>      ofbizprocs
>>>      if [ "$OFBIZ_PROCS" == "" ]; then
>>>          echo failure
>>>          echo
>>>          echo "OFBiz is not running..."
>>>          return 1
>>>      fi
>>>
>>>      # All clear
>>>      cd $OFBIZ_HOME
>>>      umask 007
>>>      $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS -shutdown >>$OFBIZ_LOG
>>>      ofbizprocs
>>>      if [ "$OFBIZ_PROCS" != "" ]; then
>>>          # Let's try to -TERM
>>>          /bin/kill -TERM $OFBIZ_PROCS
>>>      fi
>>>      ofbizprocs
>>>      if [ "$OFBIZ_PROCS" != "" ]; then
>>>          # Let's try it the hard way!
>>>          /bin/kill -9 $OFBIZ_PROCS
>>>      fi
>>>      ofbizprocs
>>>      if [ "$OFBIZ_PROCS" != "" ]; then
>>>          echo failure
>>>          echo
>>>          echo "Some processes could not be stopped:"
>>>          echo $OFBIZ_PROCS
>>>          echo "A possible solution is to try this command once more!"
>>>          return 1
>>>      else
>>>          echo success
>>>          return 0
>>>      fi
>>> }
>>>
>>> # If root is running this script, su to $OFBIZ_USER first
>>> # Note that under Debian/Ubuntu/etc. you should use instead
>>> # if [ "$USER" = "root" ]; then
>>> if [ "$UID" = "0" ]; then
>>>      exec su - $OFBIZ_USER -c "$0 $1"
>>> fi
>>>
>>> case "$1" in
>>>      'start')
>>>          start
>>>      ;;
>>>      'stop')
>>>          stop
>>>      ;;
>>>      'restart')
>>>          stop
>>>          start
>>>      ;;
>>>      'status')
>>>          ofbizprocs
>>>          if [ "$OFBIZ_PROCS" == "" ]; then
>>>              echo "OFBiz is stopped"
>>>              exit 1
>>>          else
>>>              echo "OFBiz is running"
>>>              exit 0
>>>          fi
>>>      ;;
>>>      *)
>>>          echo "Usage: $0 {start|stop|kill|restart|status|help}"
>>>          exit 1
>>>      ;;
>>> esac
>>> echo
>>> exit $?
>>>
>>>
>

Re: What am I missing? /etc/init.d type of start

Posted by Craig Parker <cr...@fossfolks.com>.
I'm on Ubuntu 14.04 server (32 bit -- this is just an old clunker 
computer I'm trying stuff out on) and the OFBIZ zip I grabbed is 13.07.03.

There was an ubuntu script I tried grabbing instead of rc.ofbiz 
(rc.ofbiz.for.ubuntu) a couple months ago, but didn't have any better 
luck with that. I think I'm going to land on Debian eventually, but if I 
can troubleshoot this install I should be able to figure that one out.


On 07/22/2016 02:24 AM, Pierre Smits wrote:
> Hi Craig,
>
> May I ask what OS version you are using and what the version of OFBiz is?
>
> Best regards,
>
> Pierre Smits
>
> ORRTIZ.COM <http://www.orrtiz.com>
> OFBiz based solutions & services
>
> OFBiz Extensions Marketplace
> http://oem.ofbizci.net/oci-2/
>
> On Fri, Jul 22, 2016 at 5:15 AM, Craig Parker <cr...@fossfolks.com> wrote:
>
>> I set this down because I couldn't get it running, but I'm picking it back
>> up. Still in the "using the demo" stage,a nd while I can start fine with
>> ./ant start from the ofbiz directory, I can't seem to get it started with
>> an /etc/init.d/ofbiz script.
>> I've tried a couple things, but the latest (back to square 1) spot I'm in
>> is copying ofbizdir/tools/rc.ofbiz /etc/init.d/ofbiz
>>
>> Not sure what I read that told me this, but I commented out .
>> /etc/rc.d/init.d/functions (in the vicinity of line 30) and .
>> /etc/sysconfig/network near line 34, changed my path to /ofbiz (where I
>> unzipped it) and also replaced any instances of echo_ with just echo  (echo
>> followed by a space).
>>
>> So here's my script, and I can't get it running. Nor can I seem to find a
>> log file anywhere that tells me what's going on. ofbiz owns the
>> /etc/init.d/ofbiz , and I'm starting it as root with sudo -u ofbiz
>> /etc/init.d/ofbiz restart
>>
>> #!/bin/sh
>> #####################################################################
>> # Licensed to the Apache Software Foundation (ASF) under one
>> # or more contributor license agreements.  See the NOTICE file
>> # distributed with this work for additional information
>> # regarding copyright ownership.  The ASF licenses this file
>> # to you under the Apache License, Version 2.0 (the
>> # "License"); you may not use this file except in compliance
>> # with the License.  You may obtain a copy of the License at
>> #
>> # http://www.apache.org/licenses/LICENSE-2.0
>> #
>> # Unless required by applicable law or agreed to in writing,
>> # software distributed under the License is distributed on an
>> # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> # KIND, either express or implied.  See the License for the
>> # specific language governing permissions and limitations
>> # under the License.
>> #####################################################################
>> #
>> # ofbiz        This shell script takes care of starting and stopping
>> #              the OFBiz subsystem
>> #
>> # chkconfig: - 80 10
>> # description: OFBiz server
>>
>> # Source function library
>> # this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
>> # => comment out and use "echo failure" and "echo success" in place of
>> echo failure and echo success (minor anyway)
>> #. /etc/rc.d/init.d/functions
>>
>> # Source networking configuration
>> # this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
>> #. /etc/sysconfig/network
>>
>> # Paths - Edit for your locations
>> JAVA_BINARY=/usr/bin/java
>> OFBIZ_HOME=/ofbiz
>> OFBIZ_LOG=$OFBIZ_HOME/runtime/logs/console.log
>>
>> # VM Options
>> JAVA_VMOPTIONS="-Xms128M -Xmx512M -XX:MaxPermSize=512m"
>>
>> # Java arguments
>> JAVA_ARGS="-jar ofbiz.jar"
>>
>> # *nix user ofbiz should run as (you must create this user first)
>> OFBIZ_USER=ofbiz
>>
>> # OFBiz processes running
>> ofbizprocs() {
>>      OFBIZ_PROCS=`/bin/ps h -o pid,args -C java | /bin/grep -e "$JAVA_ARGS"
>> | /bin/egrep -o "^[[:space:]]*[[:digit:]]*"`
>> }
>>
>> # Checking user...
>> checkuser() {
>>      if [ "$USER" != "$OFBIZ_USER" ]; then
>>          echo failure
>>          echo
>>          echo "Only users root or $OFBIZ_USER should start/stop the
>> application"
>>          exit 1
>>      fi
>> }
>>
>> # Start OFBiz
>> start() {
>>      echo -n "Starting OFBiz: "
>>      checkuser
>>      ofbizprocs
>>      if [ "$OFBIZ_PROCS" != "" ]; then
>>          echo failure
>>          echo
>>          echo "OFBiz is already running..."
>>          return 1
>>      fi
>>
>>      # All clear
>>      cd $OFBIZ_HOME
>>      umask 007
>>      /bin/rm -f $OFBIZ_LOG
>>      $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS >>$OFBIZ_LOG 2>>$OFBIZ_LOG&
>>      echo success
>>      return 0
>> }
>>
>> # Stop OFBiz
>> stop() {
>>      echo -n "Stopping OFBiz: "
>>      checkuser
>>      ofbizprocs
>>      if [ "$OFBIZ_PROCS" == "" ]; then
>>          echo failure
>>          echo
>>          echo "OFBiz is not running..."
>>          return 1
>>      fi
>>
>>      # All clear
>>      cd $OFBIZ_HOME
>>      umask 007
>>      $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS -shutdown >>$OFBIZ_LOG
>>      ofbizprocs
>>      if [ "$OFBIZ_PROCS" != "" ]; then
>>          # Let's try to -TERM
>>          /bin/kill -TERM $OFBIZ_PROCS
>>      fi
>>      ofbizprocs
>>      if [ "$OFBIZ_PROCS" != "" ]; then
>>          # Let's try it the hard way!
>>          /bin/kill -9 $OFBIZ_PROCS
>>      fi
>>      ofbizprocs
>>      if [ "$OFBIZ_PROCS" != "" ]; then
>>          echo failure
>>          echo
>>          echo "Some processes could not be stopped:"
>>          echo $OFBIZ_PROCS
>>          echo "A possible solution is to try this command once more!"
>>          return 1
>>      else
>>          echo success
>>          return 0
>>      fi
>> }
>>
>> # If root is running this script, su to $OFBIZ_USER first
>> # Note that under Debian/Ubuntu/etc. you should use instead
>> # if [ "$USER" = "root" ]; then
>> if [ "$UID" = "0" ]; then
>>      exec su - $OFBIZ_USER -c "$0 $1"
>> fi
>>
>> case "$1" in
>>      'start')
>>          start
>>      ;;
>>      'stop')
>>          stop
>>      ;;
>>      'restart')
>>          stop
>>          start
>>      ;;
>>      'status')
>>          ofbizprocs
>>          if [ "$OFBIZ_PROCS" == "" ]; then
>>              echo "OFBiz is stopped"
>>              exit 1
>>          else
>>              echo "OFBiz is running"
>>              exit 0
>>          fi
>>      ;;
>>      *)
>>          echo "Usage: $0 {start|stop|kill|restart|status|help}"
>>          exit 1
>>      ;;
>> esac
>> echo
>> exit $?
>>


Re: What am I missing? /etc/init.d type of start

Posted by Pierre Smits <pi...@gmail.com>.
Hi Craig,

May I ask what OS version you are using and what the version of OFBiz is?

Best regards,

Pierre Smits

ORRTIZ.COM <http://www.orrtiz.com>
OFBiz based solutions & services

OFBiz Extensions Marketplace
http://oem.ofbizci.net/oci-2/

On Fri, Jul 22, 2016 at 5:15 AM, Craig Parker <cr...@fossfolks.com> wrote:

> I set this down because I couldn't get it running, but I'm picking it back
> up. Still in the "using the demo" stage,a nd while I can start fine with
> ./ant start from the ofbiz directory, I can't seem to get it started with
> an /etc/init.d/ofbiz script.
> I've tried a couple things, but the latest (back to square 1) spot I'm in
> is copying ofbizdir/tools/rc.ofbiz /etc/init.d/ofbiz
>
> Not sure what I read that told me this, but I commented out .
> /etc/rc.d/init.d/functions (in the vicinity of line 30) and .
> /etc/sysconfig/network near line 34, changed my path to /ofbiz (where I
> unzipped it) and also replaced any instances of echo_ with just echo  (echo
> followed by a space).
>
> So here's my script, and I can't get it running. Nor can I seem to find a
> log file anywhere that tells me what's going on. ofbiz owns the
> /etc/init.d/ofbiz , and I'm starting it as root with sudo -u ofbiz
> /etc/init.d/ofbiz restart
>
> #!/bin/sh
> #####################################################################
> # Licensed to the Apache Software Foundation (ASF) under one
> # or more contributor license agreements.  See the NOTICE file
> # distributed with this work for additional information
> # regarding copyright ownership.  The ASF licenses this file
> # to you under the Apache License, Version 2.0 (the
> # "License"); you may not use this file except in compliance
> # with the License.  You may obtain a copy of the License at
> #
> # http://www.apache.org/licenses/LICENSE-2.0
> #
> # Unless required by applicable law or agreed to in writing,
> # software distributed under the License is distributed on an
> # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> # KIND, either express or implied.  See the License for the
> # specific language governing permissions and limitations
> # under the License.
> #####################################################################
> #
> # ofbiz        This shell script takes care of starting and stopping
> #              the OFBiz subsystem
> #
> # chkconfig: - 80 10
> # description: OFBiz server
>
> # Source function library
> # this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
> # => comment out and use "echo failure" and "echo success" in place of
> echo failure and echo success (minor anyway)
> #. /etc/rc.d/init.d/functions
>
> # Source networking configuration
> # this does not exist in Debian/Ubuntu/etc. => see rc.ofbiz.for.debian
> #. /etc/sysconfig/network
>
> # Paths - Edit for your locations
> JAVA_BINARY=/usr/bin/java
> OFBIZ_HOME=/ofbiz
> OFBIZ_LOG=$OFBIZ_HOME/runtime/logs/console.log
>
> # VM Options
> JAVA_VMOPTIONS="-Xms128M -Xmx512M -XX:MaxPermSize=512m"
>
> # Java arguments
> JAVA_ARGS="-jar ofbiz.jar"
>
> # *nix user ofbiz should run as (you must create this user first)
> OFBIZ_USER=ofbiz
>
> # OFBiz processes running
> ofbizprocs() {
>     OFBIZ_PROCS=`/bin/ps h -o pid,args -C java | /bin/grep -e "$JAVA_ARGS"
> | /bin/egrep -o "^[[:space:]]*[[:digit:]]*"`
> }
>
> # Checking user...
> checkuser() {
>     if [ "$USER" != "$OFBIZ_USER" ]; then
>         echo failure
>         echo
>         echo "Only users root or $OFBIZ_USER should start/stop the
> application"
>         exit 1
>     fi
> }
>
> # Start OFBiz
> start() {
>     echo -n "Starting OFBiz: "
>     checkuser
>     ofbizprocs
>     if [ "$OFBIZ_PROCS" != "" ]; then
>         echo failure
>         echo
>         echo "OFBiz is already running..."
>         return 1
>     fi
>
>     # All clear
>     cd $OFBIZ_HOME
>     umask 007
>     /bin/rm -f $OFBIZ_LOG
>     $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS >>$OFBIZ_LOG 2>>$OFBIZ_LOG&
>     echo success
>     return 0
> }
>
> # Stop OFBiz
> stop() {
>     echo -n "Stopping OFBiz: "
>     checkuser
>     ofbizprocs
>     if [ "$OFBIZ_PROCS" == "" ]; then
>         echo failure
>         echo
>         echo "OFBiz is not running..."
>         return 1
>     fi
>
>     # All clear
>     cd $OFBIZ_HOME
>     umask 007
>     $JAVA_BINARY $JAVA_VMOPTIONS $JAVA_ARGS -shutdown >>$OFBIZ_LOG
>     ofbizprocs
>     if [ "$OFBIZ_PROCS" != "" ]; then
>         # Let's try to -TERM
>         /bin/kill -TERM $OFBIZ_PROCS
>     fi
>     ofbizprocs
>     if [ "$OFBIZ_PROCS" != "" ]; then
>         # Let's try it the hard way!
>         /bin/kill -9 $OFBIZ_PROCS
>     fi
>     ofbizprocs
>     if [ "$OFBIZ_PROCS" != "" ]; then
>         echo failure
>         echo
>         echo "Some processes could not be stopped:"
>         echo $OFBIZ_PROCS
>         echo "A possible solution is to try this command once more!"
>         return 1
>     else
>         echo success
>         return 0
>     fi
> }
>
> # If root is running this script, su to $OFBIZ_USER first
> # Note that under Debian/Ubuntu/etc. you should use instead
> # if [ "$USER" = "root" ]; then
> if [ "$UID" = "0" ]; then
>     exec su - $OFBIZ_USER -c "$0 $1"
> fi
>
> case "$1" in
>     'start')
>         start
>     ;;
>     'stop')
>         stop
>     ;;
>     'restart')
>         stop
>         start
>     ;;
>     'status')
>         ofbizprocs
>         if [ "$OFBIZ_PROCS" == "" ]; then
>             echo "OFBiz is stopped"
>             exit 1
>         else
>             echo "OFBiz is running"
>             exit 0
>         fi
>     ;;
>     *)
>         echo "Usage: $0 {start|stop|kill|restart|status|help}"
>         exit 1
>     ;;
> esac
> echo
> exit $?
>