?
Solved

Configuring SVCS  for my script

Posted on 2013-06-24
4
Medium Priority
?
636 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 77

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 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 750 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 750 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 Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to recover a database from a user managed backup
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

743 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