Re: [ldm-users] centos/rhel v7 systemd ldm startup?

Updated GitHub Wiki to reflect this.

Regards,
Steve Emmerson

On Thu, Oct 13, 2016 at 9:59 AM, Ryan Hickman <ryan@xxxxxxxxxxxxxxxx> wrote:

> Do _not_ place this script in the ~/bin/ directory as I originally
> suggested. You'll lose access to it after an update and you'll wonder why
> `systemctl start ldm` isn't working anymore. Store in ~/scripts/ or another
> directory that isn't specific to the ldm version.
>
>
> On Tue, Oct 11, 2016 at 4:39 PM, Ryan Hickman <ryan@xxxxxxxxxxxxxxxx>
> wrote:
>
>> systemd expects a 0 for a failure and a 1 for a success, so they needed
>> to be reversed or the ExecStartPre would fail and thus LDM wouldn't get
>> started.
>>
>> I've moved the script to a GitHub Gist. I've adopted it internally as
>> well, as of course I wouldn't want my product-queue deleted/recreated for a
>> stop/start. "systemctl reload ldmd" avoided this but was just "kill -HUP"
>>
>> Good eye on the ldmadmin clean. Not sure why I removed that but it has
>> been added back.
>>
>> https://gist.github.com/NaderCHASER/59635783ccd3148ed5a4c0daf7969625
>>
>> On Tue, Oct 11, 2016 at 4:30 PM, Smith, Neil R <n-smith2@xxxxxxxxxxxxx>
>> wrote:
>>
>>> Nice!
>>> I had been wondering if one could somehow lift that queue check section
>>> from the old services startup script.
>>> BTW, any particular reason why the return error codes are ‘0’ instead of
>>> ‘1’ as with the original?
>>> And would it be OK to retain the final “$LDMADMIN clean” from the
>>> original, too?
>>> Neil
>>>
>>> On Oct 11, 2016, at 5:10 PM, Ryan Hickman <ryan@xxxxxxxxxxxxxxxx> wrote:
>>>
>>> Ah, our queue is in memory so it's gone after a reboot anyway. (
>>> https://github.com/Unidata/LDM/wiki/Best-Practices
>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Unidata_LDM_wiki_Best-2DPractices&d=CwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=8zJPpRsPyrTEl9Gc_TucyfSyLXyeQq4A_L1mQhFUBG0&m=G12NYp7K5gMFE00G4G9fx2IPS2oLlJwd4UhH78uc00M&s=PnXeo8wYJdM2MiwHBaSAbi40MQB-Qd5u1mB_j62YjVU&e=>)
>>>
>>>
>>> So I've just tested this new solution. I think it should work for you.
>>> Let me know if you notice anything wrong with it.
>>>
>>> 1) Copy/paste this script to /home/ldm/bin/pqrefresh or wherever you'd
>>> like. Make sure to "chmod +x". This script is a modified boot script which
>>> removes the ldmadmin start/stop commands and simply checks the
>>> product-queue integrity and only rebuilds it if necessary.
>>>
>>>> #!/bin/sh -
>>>>
>>>>
>>>> export PATH=/bin:/usr/bin
>>>>
>>>>
>>>> LDMHOME=/home/ldm
>>>>
>>>> LDMBIN=$LDMHOME/bin
>>>>
>>>> LDMADMIN=$LDMBIN/ldmadmin
>>>>
>>>> PQCHECK=$LDMBIN/pqcheck
>>>>
>>>> PQCAT=$LDMBIN/pqcat
>>>>
>>>> PQ=/dev/shm/ldm.pq
>>>>
>>>>
>>>> echo 'Inspecting LDM product-queue...'
>>>>
>>>> if [ -x $LDMADMIN ] ; then
>>>>
>>>>     if $LDMADMIN isrunning; then
>>>>
>>>>             echo "LDM system is currently running. Aborting."
>>>>
>>>>     else
>>>>
>>>>         if [ ! -f $PQ ] ; then
>>>>
>>>>         echo "Product-queue doesn't exist.  Creating..."
>>>>
>>>>         if ! "$LDMADMIN mkqueue"; then
>>>>
>>>>             echo "Aborting..."
>>>>
>>>>             exit 0
>>>>
>>>>         fi
>>>>
>>>>         else
>>>>
>>>>         echo "Product-queue exists. Checking..."
>>>>
>>>>         #
>>>>
>>>>         # Test the product-queue for corruption.
>>>>
>>>>         #
>>>>
>>>>         if ! $PQCHECK -l /dev/null -q $PQ; then
>>>>
>>>>             case $? in
>>>>
>>>>             0)  echo "The product-queue is okay."
>>>>
>>>>                 exit 1
>>>>
>>>>               ;;
>>>>
>>>>             1)  echo "System error checking product-queue.
>>>> Aborting..."
>>>>
>>>>             exit 0
>>>>
>>>>             ;;
>>>>
>>>>             2)  echo "Adding writer-counter to product-queue..."
>>>>
>>>>             if ! $PQCHECK -F -q $PQ; then
>>>>
>>>>                 echo "Aborting..."
>>>>
>>>>                 exit 0
>>>>
>>>>             fi
>>>>
>>>>             ;;
>>>>
>>>>             3)  echo "Product-queue was incorrectly closed.  " \
>>>>
>>>>             "Checking..."
>>>>
>>>>             if $PQCAT -s -l /dev/null; then
>>>>
>>>>                 echo "Product-queue appears OK. "
>>>>
>>>>                 echo "Clearing writer-counter..."
>>>>
>>>>                 if ! $PQCHECK -F -q $PQ; then
>>>>
>>>>             echo "Couldn't clear counter.  Aborting..."
>>>>
>>>>             exit 0
>>>>
>>>>                 fi
>>>>
>>>>             else
>>>>
>>>>                 echo "Product-queue appears corrupt.  Deleting."
>>>>
>>>>                 rm $PQ
>>>>
>>>>                 if ! "$LDMADMIN mkqueue -f"; then
>>>>
>>>>             echo "Couldn't make new product-queue.  Aborting..."
>>>>
>>>>             exit 0
>>>>
>>>>                 fi
>>>>
>>>>             fi
>>>>
>>>>             ;;
>>>>
>>>>             4)  echo "Product-queue is corrupt.  Deleting."
>>>>
>>>>             rm $PQ
>>>>
>>>>             if ! "$LDMADMIN mkqueue -f"; then
>>>>
>>>>                 echo "Couldn't make new product-queue.  Aborting..."
>>>>
>>>>                 exit 0
>>>>
>>>>             fi
>>>>
>>>>             ;;
>>>>
>>>>             esac
>>>>
>>>>         fi
>>>>
>>>>         fi
>>>>
>>>>     fi
>>>>
>>>> fi
>>>>
>>>
>>> 2) Remove the ExecStartPre entries I referenced in my previous email.
>>> Add a new ExecStartPre= entry that points to this newly created script.
>>>
>>> 3) Run "systemctl daemon-reload"
>>>
>>> Good to go!
>>>
>>> On Tue, Oct 11, 2016 at 3:35 PM, Smith, Neil R <n-smith2@xxxxxxxxxxxxx>
>>> wrote:
>>>
>>>> Is there a way to do the pqcheck stuff as with the traditional init.d
>>>> script?
>>>>
>>>> If I’ve got a pretty full suite of stuff I’m ingesting, it seems a
>>>> waist to have to re-request the last hour’s worth (default) of
>>>> queue content from upstream each time I reboot the OS.
>>>>
>>>> Neil
>>>>
>>>>
>>>> On Oct 11, 2016, at 4:21 PM, Ryan Hickman <ryan@xxxxxxxxxxxxxxxx>
>>>> wrote:
>>>>
>>>> Neil,
>>>>
>>>> Yes, per
>>>>
>>>>> ExecStartPre=/home/ldm/bin/ldmadmin delqueue
>>>>> ExecStartPre=/home/ldm/bin/ldmadmin mkqueue
>>>>>
>>>>>
>>>>
>>>>
>>>> On Tue, Oct 11, 2016 at 3:15 PM, Smith, Neil R <n-smith2@xxxxxxxxxxxxx>
>>>> wrote:
>>>>
>>>>> Steve,
>>>>> Does that delete and re-create the queue at each boot?
>>>>> Neil
>>>>>
>>>>> On Oct 11, 2016, at 3:33 PM, Steve Emmerson <emmerson@xxxxxxxx> wrote:
>>>>>
>>>>> All,
>>>>>
>>>>> I added it to the LDM Wiki on GitHub <https://github.com/Unidata/LD
>>>>> M/wiki
>>>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Unidata_LDM_wiki&d=CwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=8zJPpRsPyrTEl9Gc_TucyfSyLXyeQq4A_L1mQhFUBG0&m=KIIr4ObmAsAkjemOKkKG5rGaKnygm5MvB9x-_ki-3HU&s=Q6CTZm6w95pyDDGJ--bWSXZRRTYoM6HQlYDJEuyYCzg&e=>
>>>>> >.
>>>>>
>>>>> Regards,
>>>>> Steve Emmerson
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> NOTE: All exchanges posted to Unidata maintained email lists are
>>>>> recorded in the Unidata inquiry tracking system and made publicly
>>>>> available through the web.  Users who post to any of the lists we
>>>>> maintain are reminded to remove any personal information that they
>>>>> do not want to be made public.
>>>>>
>>>>>
>>>>> ldm-users mailing list
>>>>> ldm-users@xxxxxxxxxxxxxxxx
>>>>> For list information or to unsubscribe,  visit:
>>>>> http://www.unidata.ucar.edu/mailing_lists/
>>>>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.unidata.ucar.edu_mailing-5Flists_&d=CwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=8zJPpRsPyrTEl9Gc_TucyfSyLXyeQq4A_L1mQhFUBG0&m=b63HcUY6cN8AB11ZnPEocbvGQwC5TkCsnXwwKPWfhb8&s=WUDyrbnLGclHA4a2C8JYzuRoWjcgLe5m3aTk7574snI&e=>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>
  • 2016 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the ldm-users archives: