| 415 | |
| 416 | === !OpenSuse Init Script === |
| 417 | |
| 418 | ==== Deluged ==== |
| 419 | |
| 420 | {{{ |
| 421 | #!sh |
| 422 | #! /bin/sh |
| 423 | # Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany. |
| 424 | # |
| 425 | # Author: José Ferrandis |
| 426 | # |
| 427 | # /etc/init.d/deluged |
| 428 | # |
| 429 | # and symbolic its link |
| 430 | # |
| 431 | # /usr/sbin/deluged |
| 432 | # |
| 433 | ### BEGIN INIT INFO |
| 434 | # Provides: deluged |
| 435 | # Required-Start: $local_fs $remote_fs |
| 436 | # Required-Stop: $local_fs $remote_fs |
| 437 | # Should-Start: $network |
| 438 | # Should-Stop: $network |
| 439 | |
| 440 | # Default-Start: 3 5 |
| 441 | # Default-Stop: 0 1 2 6 |
| 442 | # Short-Description: Daemonized version of deluge. |
| 443 | # Description: Starts the deluge daemon. |
| 444 | |
| 445 | ### END INIT INFO |
| 446 | |
| 447 | DELUGED_BIN=/usr/bin/deluged |
| 448 | test -x $DELUGED_BIN || exit 5 |
| 449 | |
| 450 | DELUGED_USER="" # CHANGE THIS |
| 451 | test -z "$DELUGED_USER" || exit 6 |
| 452 | |
| 453 | DELUGED_PIDFILE=/var/run/deluged.pid |
| 454 | |
| 455 | DELUGED_ARGS="-P $DELUGED_PIDFILE" # consult man deluged for more options |
| 456 | |
| 457 | . /etc/rc.status |
| 458 | |
| 459 | # Shell functions sourced from /etc/rc.status: |
| 460 | # rc_check check and set local and overall rc status |
| 461 | # rc_status check and set local and overall rc status |
| 462 | # rc_status -v ditto but be verbose in local rc status |
| 463 | # rc_status -v -r ditto and clear the local rc status |
| 464 | # rc_failed set local and overall rc status to failed |
| 465 | # rc_reset clear local rc status (overall remains) |
| 466 | # rc_exit exit appropriate to overall rc status |
| 467 | |
| 468 | # First reset status of this service |
| 469 | rc_reset |
| 470 | |
| 471 | case "$1" in |
| 472 | start) |
| 473 | |
| 474 | echo -n "Starting DELUGE daemon" |
| 475 | ## Start daemon with startproc(8). If this fails |
| 476 | ## the echo return value is set appropriate. |
| 477 | |
| 478 | startproc -f -u $DELUGED_USER $DELUGED_BIN $DELUGED_ARGS |
| 479 | |
| 480 | # Remember status and be verbose |
| 481 | rc_status -v |
| 482 | ;; |
| 483 | stop) |
| 484 | echo -n "Shutting down DELUGE daemon" |
| 485 | ## Stop daemon with killproc(8) and if this fails |
| 486 | ## set echo the echo return value. |
| 487 | |
| 488 | killproc -TERM $DELUGED_BIN |
| 489 | |
| 490 | # Remember status and be verbose |
| 491 | rc_status -v |
| 492 | ;; |
| 493 | try-restart) |
| 494 | ## Stop the service and if this succeeds (i.e. the |
| 495 | ## service was running before), start it again. |
| 496 | $0 status >/dev/null && $0 restart |
| 497 | |
| 498 | # Remember status and be quiet |
| 499 | rc_status |
| 500 | ;; |
| 501 | restart) |
| 502 | ## Stop the service and regardless of whether it was |
| 503 | ## running or not, start it again. |
| 504 | $0 stop |
| 505 | $0 start |
| 506 | |
| 507 | # Remember status and be quiet |
| 508 | rc_status |
| 509 | ;; |
| 510 | force-reload|reload) |
| 511 | ## Signal the daemon to reload its config. Most daemons |
| 512 | ## do this on signal 1 (SIGHUP). |
| 513 | |
| 514 | echo -n "Reload service DELUGED" |
| 515 | |
| 516 | killproc -HUP $DELUGED_BIN |
| 517 | |
| 518 | rc_status -v |
| 519 | |
| 520 | ;; |
| 521 | status) |
| 522 | echo -n "Checking for service DELUGED " |
| 523 | ## Check status with checkproc(8), if process is running |
| 524 | ## checkproc will return with exit status 0. |
| 525 | |
| 526 | # Status has a slightly different for the status command: |
| 527 | # 0 - service running |
| 528 | # 1 - service dead, but /var/run/ pid file exists |
| 529 | # 2 - service dead, but /var/lock/ lock file exists |
| 530 | # 3 - service not running |
| 531 | |
| 532 | checkproc $DELUGED_BIN |
| 533 | |
| 534 | rc_status -v |
| 535 | ;; |
| 536 | probe) |
| 537 | ## Optional: Probe for the necessity of a reload, |
| 538 | ## give out the argument which is required for a reload. |
| 539 | |
| 540 | #test /etc/ssh/sshd_config -nt $SSHD_PIDFILE && echo reload |
| 541 | ;; |
| 542 | *) |
| 543 | echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" |
| 544 | exit 1 |
| 545 | ;; |
| 546 | esac |
| 547 | rc_exit |
| 548 | }}} |
| 549 | |
| 550 | ==== Web UI ==== |
| 551 | |
| 552 | {{{ |
| 553 | #!sh |
| 554 | #! /bin/sh |
| 555 | # Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany. |
| 556 | # |
| 557 | # Author: José Ferrandis |
| 558 | # |
| 559 | # /etc/init.d/deluge-webd |
| 560 | # |
| 561 | # and symbolic its link |
| 562 | # |
| 563 | # /usr/sbin/deluge-webd |
| 564 | # |
| 565 | ### BEGIN INIT INFO |
| 566 | # Provides: deluge-webd |
| 567 | # Required-Start: $local_fs $remote_fs |
| 568 | # Required-Stop: $local_fs $remote_fs |
| 569 | # Should-Start: $network |
| 570 | # Should-Stop: $network |
| 571 | |
| 572 | # Default-Start: 3 5 |
| 573 | # Default-Stop: 0 1 2 6 |
| 574 | # Short-Description: Daemonized version of deluge-web. |
| 575 | # Description: Starts the deluge-web daemon. |
| 576 | |
| 577 | ### END INIT INFO |
| 578 | |
| 579 | DELUGED_WEB_BIN=/usr/bin/deluge-web |
| 580 | test -x $DELUGED_WEB_BIN || exit 5 |
| 581 | |
| 582 | DELUGED_WEB_USER="" # CHANGE THIS |
| 583 | test -z "$DELUGED_WEB_USER" || exit 6 |
| 584 | |
| 585 | DELUGED_WEB_PIDFILE=/var/run/deluge-web.pid |
| 586 | |
| 587 | DELUGED_WEB_ARGS="" # consult man deluge-web for options |
| 588 | |
| 589 | . /etc/rc.status |
| 590 | |
| 591 | # Shell functions sourced from /etc/rc.status: |
| 592 | # rc_check check and set local and overall rc status |
| 593 | # rc_status check and set local and overall rc status |
| 594 | # rc_status -v ditto but be verbose in local rc status |
| 595 | # rc_status -v -r ditto and clear the local rc status |
| 596 | # rc_failed set local and overall rc status to failed |
| 597 | # rc_reset clear local rc status (overall remains) |
| 598 | # rc_exit exit appropriate to overall rc status |
| 599 | |
| 600 | # First reset status of this service |
| 601 | rc_reset |
| 602 | |
| 603 | case "$1" in |
| 604 | start) |
| 605 | |
| 606 | echo -n "Starting DELUGE-WEB daemon" |
| 607 | ## Start daemon with startproc(8). If this fails |
| 608 | ## the echo return value is set appropriate. |
| 609 | |
| 610 | startproc -f -u $DELUGED_WEB_USER $DELUGED_WEB_BIN $DELUGED_WEB_ARGS |
| 611 | |
| 612 | # Remember status and be verbose |
| 613 | rc_status -v |
| 614 | ;; |
| 615 | stop) |
| 616 | echo -n "Shutting down DELUGE-WEB daemon" |
| 617 | ## Stop daemon with killproc(8) and if this fails |
| 618 | ## set echo the echo return value. |
| 619 | |
| 620 | killproc -TERM $DELUGED_WEB_BIN |
| 621 | |
| 622 | # Remember status and be verbose |
| 623 | rc_status -v |
| 624 | ;; |
| 625 | try-restart) |
| 626 | ## Stop the service and if this succeeds (i.e. the |
| 627 | ## service was running before), start it again. |
| 628 | $0 status >/dev/null && $0 restart |
| 629 | |
| 630 | # Remember status and be quiet |
| 631 | rc_status |
| 632 | ;; |
| 633 | restart) |
| 634 | ## Stop the service and regardless of whether it was |
| 635 | ## running or not, start it again. |
| 636 | $0 stop |
| 637 | $0 start |
| 638 | |
| 639 | # Remember status and be quiet |
| 640 | rc_status |
| 641 | ;; |
| 642 | force-reload|reload) |
| 643 | ## Signal the daemon to reload its config. Most daemons |
| 644 | ## do this on signal 1 (SIGHUP). |
| 645 | |
| 646 | echo -n "Reload service DELUGED_WEB" |
| 647 | |
| 648 | killproc -HUP $DELUGED_WEB_BIN |
| 649 | |
| 650 | rc_status -v |
| 651 | |
| 652 | ;; |
| 653 | status) |
| 654 | echo -n "Checking for service DELUGED_WEB " |
| 655 | ## Check status with checkproc(8), if process is running |
| 656 | ## checkproc will return with exit status 0. |
| 657 | |
| 658 | # Status has a slightly different for the status command: |
| 659 | # 0 - service running |
| 660 | # 1 - service dead, but /var/run/ pid file exists |
| 661 | # 2 - service dead, but /var/lock/ lock file exists |
| 662 | # 3 - service not running |
| 663 | |
| 664 | checkproc $DELUGED_WEB_BIN |
| 665 | |
| 666 | rc_status -v |
| 667 | ;; |
| 668 | probe) |
| 669 | ## Optional: Probe for the necessity of a reload, |
| 670 | ## give out the argument which is required for a reload. |
| 671 | |
| 672 | #test /etc/ssh/sshd_config -nt $SSHD_PIDFILE && echo reload |
| 673 | ;; |
| 674 | *) |
| 675 | echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" |
| 676 | exit 1 |
| 677 | ;; |
| 678 | esac |
| 679 | rc_exit |
| 680 | }}} |