README 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. ##pysystemd
  2. a systemd binding Library in python
  3. its Support python 2.7, python3
  4. ### install
  5. to install pysystemd use pip install pysystemd
  6. ### How to use
  7. this library contains 4 classes
  8. 1- status
  9. this class Contain Methods to query the status of the services
  10. it take the service name as Parameter
  11. to check if the service running or not you can use()
  12. is_running
  13. """ if the service running return 0. """
  14. to check if the service enable or not you can use
  15. is_enable()
  16. """ if the service enabled return 0. """
  17. 2- services
  18. this class use to """manage the services like running and stop and reboot."""
  19. it take the service name as Parameter
  20. to run service use
  21. start()
  22. return 0 if Succeed.
  23. to stop service use
  24. stop()
  25. return 0 if Succeed.
  26. to restart service use restart()
  27. to relode service
  28. use relode()
  29. 3- list_services
  30. this class use to list services
  31. to list all services
  32. use list_all()
  33. its return services names as list
  34. to list all running services
  35. use list_running()
  36. its return running services as list
  37. to list all not running services
  38. use
  39. list_dont_running()
  40. its return dont running services as list
  41. to list all enable services
  42. use()
  43. list_enable
  44. its return all enabled services as list
  45. to list all disable services
  46. use
  47. list_disable()
  48. its return all disabled services as list
  49. 4- power
  50. this class use to manage the power in the system
  51. to poweroff
  52. to poweroff the system use
  53. poweroff()
  54. the reboot the system use
  55. reboot()
  56. to boot to rescue mode use
  57. rescue()
  58. to suspend the system use
  59. suspend()