Solved

Configuring SVCS  for my script

Posted on 2013-06-24
4
589 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Many people tend to confuse the function of a virus with the one of adware, this misunderstanding of the basic of what each software is and how it operates causes users and organizations to take the wrong security measures that would protect them ag…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now