rc.gnusocial-queuedaemon 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/sh
  2. #
  3. # Start/stop/restart GNU social queuedaemon.
  4. #
  5. # Copyright (C) 2024 Ricardo García Jiménez <ricardogj08@riseup.net>
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. #
  20. gnusocial_queuedaemon_start() {
  21. if [ -r /var/lib/gnusocial/run/queuedaemon.generic.pid ]; then
  22. echo "GNU social queuedaemon is already running: $(cat /var/lib/gnusocial/run/queuedaemon.generic.pid)"
  23. exit 1
  24. fi
  25. if [ -r /var/lib/gnusocial/scripts/startdaemons.sh ]; then
  26. sh /var/lib/gnusocial/scripts/startdaemons.sh
  27. echo "Starting GNU social queuedaemon: sh /var/lib/gnusocial/scripts/startdaemons.sh"
  28. fi
  29. }
  30. gnusocial_queuedaemon_error() {
  31. echo "GNU social queuedaemon does not seem to be running"
  32. exit 1
  33. }
  34. gnusocial_queuedaemon_stop() {
  35. if [ -r /var/lib/gnusocial/run/queuedaemon.generic.pid ] && [ -r /var/lib/gnusocial/scripts/stopdaemons.sh ]; then
  36. sh /var/lib/gnusocial/scripts/stopdaemons.sh
  37. else
  38. gnusocial_queuedaemon_error
  39. fi
  40. }
  41. gnusocial_queuedaemon_restart() {
  42. gnusocial_queuedaemon_stop
  43. gnusocial_queuedaemon_start
  44. }
  45. gnusocial_queuedaemon_status() {
  46. if [ -r /var/lib/gnusocial/run/queuedaemon.generic.pid ]; then
  47. echo "GNU social queuedaemon is running: $(cat /var/lib/gnusocial/run/queuedaemon.generic.pid)"
  48. else
  49. gnusocial_queuedaemon_error
  50. fi
  51. }
  52. case "$1" in
  53. 'start')
  54. gnusocial_queuedaemon_start
  55. ;;
  56. 'stop')
  57. gnusocial_queuedaemon_stop
  58. ;;
  59. 'restart')
  60. gnusocial_queuedaemon_restart
  61. ;;
  62. 'status')
  63. gnusocial_queuedaemon_status
  64. ;;
  65. *)
  66. echo "usage $0 start|stop|restart|status"
  67. esac