Solved

Configuring SVCS  for my script

Posted on 2013-06-24
4
603 Views
Last Modified: 2013-07-12
I am trying setup a svcs and i am getting svccfg: couldn't parse document when i tried to validate my xml document. Please advise on how to fix this. I am new to svcs.

root@:/var/svc/manifest/site> ls -l /lib/svc/method/myscript
-rwxr-xr-x   1 root     root         544 Jun 24 14:00 /lib/svc/method/myscript
root@:/var/svc/manifest/site> cat /lib/svc/method/myscript
#!/bin/bash
#
# creating and removing file during startup
#
#
#
# See how we were called.


case $1 in
        start)
            echo "myfile has been created"
            touch  /tmp/myfile
            ;;
        restart)
            echo "your script stopping"
            rm /tmp/myfile
            echo "your script starting"
        touch /tmp/myfile
            ;;
        status)
            echo "your script running"
            ;;
        stop)
            echo "your script stopping"
            rm /tmp/myfile
            ;;
esac



root@:/var/svc/manifest/site> svccfg validate /var/svc/manifest/site/myservice.xml
svccfg: couldn't parse document
root@:/var/svc/manifest/site> cat /var/svc/manifest/site/myservice.xml
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM
    /usr/share/lib/xml/dtd/service_bundle.dtd.1">

<service_bundle type="manifest" name="manoservice">
  <service name="site/manoservice" type="service" version="1">
    <create_default_instance enabled="false" />

    <!-- Dependencies -->
    <dependency
        name="filesystem-local" grouping="require_all"
        restart_on="restart" type="service">
        <service_fmri value="svc:/system/filesystem/local:default" />
    </dependency>

    <!-- Execution method for start and stop -->
    <exec_method
         type="method" name="start"
         exec="/lib/svc/method/myscript" timeout_seconds="60" >
      <method_context>
          <method_credential user="root" group="root" />
      </method_context>
    </exec_method>

    <exec_method
       type="method" name="stop" exec=":kill -9"
       timeout_seconds="60" >
    </exec_method>

    <template>
       <common_name>
         <loctext xml:lang="C">My example service</loctext>
       </common_name>
       <documentation>
          <manpage title="No man" section="99" manpath="/dev/null" />
       </documentation>
    </template>
  </service>
</service_bundle>
0
Comment
Question by:ittechlab
  • 2
4 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39274695
>><!DOCTYPE service_bundle SYSTEM /usr/share/lib/xml/dtd/service_bundle.dtd.1">

Missing a double quote in this line.

To find errors, open the xml file in any xml validator.  For the error above, I just used Internet Explorer.
0
 

Author Comment

by:ittechlab
ID: 39275835
Thanks. after i fixed the double quote, I am not getting any error. From here I am not sure how to proceed. Please advise.

root@:/root> svccfg validate /var/svc/manifest/site/myservice.xml
root@:/root>
0
 
LVL 76

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 250 total points
ID: 39275848
I don't know.  Never used it before.

I was just responding to the original question:  "tried to validate my xml document. Please advise on how to fix this.".

I did see there was a svccfg apply option but I have no way to know if that is the next step or not.

I would check the docs on setting up services for the next step.
0
 
LVL 1

Accepted Solution

by:
Ponmaniraja earned 250 total points
ID: 39277424
Hi,

Just you have to import the script in the svccfg utility, Usebelow

svccfg import /var/svc/manifest/site/myservice.xml

Follow by svcadm refresh and restart commands.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unix, date minus 1, 2 or 3 days (last working day) 11 53
Log File Creation with Header and Footer 17 95
aix unix tar error 3 66
passing parameters to sql script oracle 4 41
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question