README 1.7 KB

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