Advertisement
Guest User

Hypnotoad init-service

a guest
Jun 11th, 2015
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. root@kohatrusty:~# service koha-api-daemon start
  2. Starting Hypnotoad
  3. ALL GLORY TO THE HYPNOTOAD.
  4. Use of uninitialized value $0 in scalar assignment at /usr/local/share/perl/5.14.2/Mojo/Server/Hypnotoad.pm line 44, <DATA> line 2231.
  5. /api/v1/script.cgiUsage: hypnotoad [OPTIONS] [APPLICATION]
  6.  
  7.  
  8.  
  9. kivilahtio@kohatrusty:/home/koha/kohaclone$ cat /etc/init.d/koha-api-daemon
  10. #!/bin/bash
  11.  
  12. # This file is part of Koha.
  13. #
  14. # Koha is free software; you can redistribute it and/or modify it
  15. # under the terms of the GNU General Public License as published by
  16. # the Free Software Foundation; either version 3 of the License, or
  17. # (at your option) any later version.
  18. #
  19. # Koha is distributed in the hope that it will be useful, but
  20. # WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. # GNU General Public License for more details.
  23. #
  24. # You should have received a copy of the GNU General Public License
  25. # along with Koha; if not, see <http://www.gnu.org/licenses>.
  26.  
  27. ### BEGIN INIT INFO
  28. # Provides: koha-api-daemon
  29. # Required-Start: $syslog $remote_fs
  30. # Required-Stop: $syslog $remote_fs
  31. # Default-Start: 2 3 4 5
  32. # Default-Stop: 0 1 6
  33. # Short-Description: Hypnotoad Mojolicious Server for handling Koha API requests
  34. ### END INIT INFO
  35.  
  36. USER=kivilahtio
  37. loggedInUser=`whoami`
  38. NAME=koha-api-daemon
  39.  
  40. test -f $ZEBRASRV || exit 0
  41.  
  42. OTHERUSER=''
  43. if [[ $EUID -ne 0 && $loggedInUser -ne $USER ]]; then
  44. echo "You must run this script as 'root' or as '$USER'";
  45. exit 1;
  46. fi
  47.  
  48. function start {
  49. echo "Starting Hypnotoad"
  50. echo "ALL GLORY TO THE HYPNOTOAD."
  51. su --shell /bin/bash -c "hypnotoad $PERL5LIB/api/v1/script.cgi" $USER
  52. }
  53. function stop {
  54. echo "Stopping Hypnotoad"
  55. su --shell /bin/bash -c "hypnotoad $PERL5LIB/api/v1/script.cgi -s" $USER
  56. }
  57.  
  58. case "$1" in
  59. start)
  60. start
  61. ;;
  62. stop)
  63. stop
  64. ;;
  65. restart)
  66. echo "Restarting Hypnotoad"
  67. stop
  68. start
  69. ;;
  70. *)
  71. echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
  72. exit 1
  73. ;;
  74. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement