Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 654
  • Last Modified:

Configuring SVCS for my script

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
ittechlab
Asked:
ittechlab
  • 2
2 Solutions
 
slightwv (䄆 Netminder) Commented:
>><!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
 
ittechlabLinux SupportAuthor Commented:
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
 
slightwv (䄆 Netminder) Commented:
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
 
PonmanirajaCommented:
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now