免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2049 | 回复: 0
打印 上一主题 下一主题

自己写了一个服务,一直处于maintance状态 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-09-09 11:10 |只看该作者 |倒序浏览
本帖最后由 ncist2011 于 2015-09-09 11:12 编辑

1、zpool-state.xml
/lib/svc/manifest/system/zpool-state.xml
  1.   1 <?xml version='1.0'?>
  2.   2 <!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
  3.   3
  4.   4 <service_bundle type='manifest' name='zpool-state'>
  5.   5
  6.   6 <service
  7.   7     name='system/zpool-state'
  8.   8     type='service'
  9.   9     version='1'>
  10. 10
  11. 11     <create_default_instance enabled='true' />
  12. 12     <!--
  13. 13        Set a timeout of -1 to signify to inetd that we don't want
  14. 14        to timeout this service, since the forked process is the
  15. 15        one that does the services work. This is the case for most/all
  16. 16        legacy inetd services; for services written to take advantage
  17. 17        of Greenlines capabilities, the start method should fork
  18. 18        off a process to handle the request and return a success code.
  19. 19     -->
  20. 20     <exec_method
  21. 21         type='method'
  22. 22         name='start'
  23. 23         exec='/lib/svc/method/zpool-state start'
  24. 24         timeout_seconds='60'>
  25. 25     </exec_method>
  26. 26
  27. 27     <exec_method
  28. 28         type='method'
  29. 29         name='stop'
  30. 30         exec=':kill'
  31. 31         timeout_seconds='60'>
  32. 32     </exec_method>
  33. 33
  34. 34     <method_context>
  35. 35     <method_credential user='root' group='root' />
  36. 36     </method_context>
  37. 37
  38. 38     <property_group name='startd'
  39. 39         type='framework'>
  40. 40         <!-- sub-process core dumps shouldn't restart session -->
  41. 41         <propval name='duration' type='astring' value='transient' />
  42. 42     </property_group>
  43. 43
  44. 44     <stability value='Evolving' />
  45. 45
  46. 46     <template>
  47. 47         <common_name>
  48. 48             <loctext xml:lang='C'>
  49. 49                         get zpool state
  50. 50             </loctext>
  51. 51         </common_name>
  52. 52
  53. 53     </template>
  54. 54 </service>
  55. 55
  56. 56 </service_bundle>
复制代码
2、/lib/svc/method/zpool-state
  1.   1 #!/bin/sh
  2.   2
  3.   3 . /lib/svc/share/smf_include.sh
  4.   4
  5.   5 case "$1" in
  6.   6 'start')
  7.   7     /usr/sbin/zpoolstaterpc
  8.   8     ;;
  9.   9
  10. 10 'stop')
  11. 11     pkill -f zpoolstaterpc
  12. 12     ;;
  13. 13
  14. 14 *)
  15. 15     exit 1
  16. 16     ;;
  17. 17 esac
  18. 18 exit $SMF_EXIT_OK
复制代码
3、/usr/sbin/zpoolstaterpc
  1. 1 #!/usr/bin/python3
  2.   2
  3.   3 import os
  4.   4 import time
  5.   5 from pi.zfs.zpoolstatus import *
  6.   6
  7.   7 if __name__ == '__main__':
  8.   8     print('1111')
复制代码
4、svcs -x zpool-state
  1. State: maintenance since September  9, 2015 10:40:18 AM CST
  2. Reason: Restarting too quickly, last exited with status 127.
  3.       See: /var/svc/log/system-zpool-state:default.log
  4. Impact: This service is not running.
复制代码
5、system-zpool-state:default.log
  1. 521 [ Sep  9 10:37:32 Leaving maintenance because clear requested. ]
  2. 522 [ Sep  9 10:37:32 Enabled. ]
  3. 523 [ Sep  9 10:37:32 Executing start method ("/lib/svc/method/zpool-state start"). ]
  4. 524 1111
  5. 525 [ Sep  9 10:37:33 Method "start" exited with status 0. ]
  6. 526 [ Sep  9 10:37:33 Stopping because all processes in service exited. ]
  7. 527 [ Sep  9 10:37:33 Executing stop method (:kill). ]
  8. 528 [ Sep  9 10:37:33 Executing start method ("/lib/svc/method/zpool-state start"). ]
  9. 529 1111
  10. 530 [ Sep  9 10:37:34 Method "start" exited with status 0. ]
  11. 531 [ Sep  9 10:37:34 Stopping because all processes in service exited. ]
  12. 532 [ Sep  9 10:37:34 Executing stop method (:kill). ]
  13. 533 [ Sep  9 10:37:34 Executing start method ("/lib/svc/method/zpool-state start"). ]
  14. 534 1111
  15. 535 [ Sep  9 10:37:35 Method "start" exited with status 0. ]
  16. 536 [ Sep  9 10:37:35 Stopping because all processes in service exited. ]
  17. 537 [ Sep  9 10:37:35 Executing stop method (:kill). ]
  18. 538 [ Sep  9 10:37:35 Executing start method ("/lib/svc/method/zpool-state start"). ]
  19. 539 1111
  20. 540 [ Sep  9 10:37:36 Method "start" exited with status 0. ]
  21. 541 [ Sep  9 10:37:36 Stopping because all processes in service exited. ]
  22. 542 [ Sep  9 10:37:36 Executing stop method (:kill). ]
  23. 543 [ Sep  9 10:37:36 Restarting too quickly, changing state to maintenance. ]
复制代码
一直没找到原因在哪
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP