Changes between Initial Version and Version 1 of UserGuide/InitScript/OpenSUSE


Ignore:
Timestamp:
04/07/2010 04:06:04 PM (14 years ago)
Author:
Cas
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UserGuide/InitScript/OpenSUSE

    v1 v1  
     1= openSUSE Init Script = 
     2 
     3== Deluged == 
     4 
     5{{{ 
     6#!sh 
     7#! /bin/sh 
     8# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany. 
     9# 
     10# Author: José Ferrandis 
     11# 
     12# /etc/init.d/deluged 
     13# 
     14#   and symbolic its link 
     15# 
     16# /usr/sbin/deluged 
     17# 
     18### BEGIN INIT INFO 
     19# Provides: deluged 
     20# Required-Start: $local_fs $remote_fs 
     21# Required-Stop: $local_fs $remote_fs 
     22# Should-Start: $network 
     23# Should-Stop: $network 
     24 
     25# Default-Start: 3 5 
     26# Default-Stop: 0 1 2 6 
     27# Short-Description: Daemonized version of deluge. 
     28# Description:       Starts the deluge daemon. 
     29### END INIT INFO 
     30 
     31DELUGED_BIN=/usr/bin/deluged 
     32 
     33test -x $DELUGED_BIN || exit 5 
     34 
     35DELUGED_USER="deluge"        # CHANGE THIS 
     36test -n "$DELUGED_USER" || exit 6 
     37 
     38DELUGED_PIDFILE=~/.config/deluge/deluged.pid 
     39 
     40DELUGED_ARGS="-P DELUGED_PIDFILE" # consult man deluged for more options 
     41 
     42. /etc/rc.status 
     43 
     44# Shell functions sourced from /etc/rc.status: 
     45#      rc_check         check and set local and overall rc status 
     46#      rc_status        check and set local and overall rc status 
     47#      rc_status -v     ditto but be verbose in local rc status 
     48#      rc_status -v -r  ditto and clear the local rc status 
     49#      rc_failed        set local and overall rc status to failed 
     50#      rc_reset         clear local rc status (overall remains) 
     51#      rc_exit          exit appropriate to overall rc status 
     52 
     53# First reset status of this service 
     54rc_reset 
     55 
     56case "$1" in 
     57    start) 
     58         
     59        echo -n "Starting DELUGE daemon" 
     60        ## Start daemon with startproc(8). If this fails 
     61        ## the echo return value is set appropriate. 
     62 
     63        startproc -p $DELUGED_PIDFILE -u $DELUGED_USER $DELUGED_BIN $DELUGED_ARGS 
     64 
     65        # Remember status and be verbose 
     66        rc_status -v 
     67        ;; 
     68    stop) 
     69        echo -n "Shutting down DELUGE daemon" 
     70        ## Stop daemon with killproc(8) and if this fails 
     71        ## set echo the echo return value. 
     72 
     73        killproc -TERM $DELUGED_BIN 
     74 
     75        # Remember status and be verbose 
     76        rc_status -v 
     77        ;; 
     78    try-restart) 
     79        ## Stop the service and if this succeeds (i.e. the  
     80        ## service was running before), start it again. 
     81        $0 status >/dev/null &&  $0 restart 
     82 
     83        # Remember status and be quiet 
     84        rc_status 
     85        ;; 
     86    restart) 
     87        ## Stop the service and regardless of whether it was 
     88        ## running or not, start it again. 
     89        $0 stop 
     90        $0 start 
     91 
     92        # Remember status and be quiet 
     93        rc_status 
     94        ;; 
     95    force-reload|reload) 
     96        ## Signal the daemon to reload its config. Most daemons 
     97        ## do this on signal 1 (SIGHUP). 
     98 
     99        echo -n "Reload service DELUGED" 
     100 
     101        killproc -HUP $DELUGED_BIN 
     102 
     103        rc_status -v 
     104 
     105        ;; 
     106    status) 
     107        echo -n "Checking for service DELUGED " 
     108        ## Check status with checkproc(8), if process is running 
     109        ## checkproc will return with exit status 0. 
     110 
     111        # Status has a slightly different for the status command: 
     112        # 0 - service running 
     113        # 1 - service dead, but /var/run/  pid  file exists 
     114        # 2 - service dead, but /var/lock/ lock file exists 
     115        # 3 - service not running 
     116 
     117        checkproc $DELUGED_BIN 
     118 
     119        rc_status -v 
     120        ;; 
     121    probe) 
     122        ## Optional: Probe for the necessity of a reload, 
     123        ## give out the argument which is required for a reload. 
     124 
     125        ;; 
     126    *) 
     127        echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" 
     128        exit 1 
     129        ;; 
     130esac 
     131rc_exit 
     132}}} 
     133 
     134== Web UI == 
     135 
     136{{{ 
     137#!sh 
     138#! /bin/sh 
     139# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany. 
     140# 
     141# Author: José Ferrandis 
     142# 
     143# /etc/init.d/deluge-webd 
     144# 
     145#   and symbolic its link 
     146# 
     147# /usr/sbin/deluge-webd 
     148# 
     149### BEGIN INIT INFO 
     150# Provides: deluge-webd 
     151# Required-Start: $local_fs $remote_fs 
     152# Required-Stop: $local_fs $remote_fs 
     153# Should-Start: $network 
     154# Should-Stop: $network 
     155 
     156# Default-Start: 3 5 
     157# Default-Stop: 0 1 2 6 
     158# Short-Description: Daemonized version of deluge-web. 
     159# Description:       Starts the deluge-web daemon. 
     160 
     161### END INIT INFO 
     162 
     163DELUGED_WEB_BIN=/usr/bin/deluge-web 
     164test -x $DELUGED_WEB_BIN || exit 5 
     165 
     166DELUGED_WEB_USER="deluge" 
     167 
     168. /etc/rc.status 
     169 
     170# Shell functions sourced from /etc/rc.status: 
     171#      rc_check         check and set local and overall rc status 
     172#      rc_status        check and set local and overall rc status 
     173#      rc_status -v     ditto but be verbose in local rc status 
     174#      rc_status -v -r  ditto and clear the local rc status 
     175#      rc_failed        set local and overall rc status to failed 
     176#      rc_reset         clear local rc status (overall remains) 
     177#      rc_exit          exit appropriate to overall rc status 
     178 
     179# First reset status of this service 
     180rc_reset 
     181 
     182case "$1" in 
     183    start) 
     184         
     185        echo -n "Starting DELUGE-WEB daemon" 
     186        ## Start daemon with startproc(8). If this fails 
     187        ## the echo return value is set appropriate. 
     188 
     189        startproc -f -u $DELUGED_WEB_USER $DELUGED_WEB_BIN 
     190 
     191        # Remember status and be verbose 
     192        rc_status -v 
     193        ;; 
     194    stop) 
     195        echo -n "Shutting down DELUGE-WEB daemon" 
     196        ## Stop daemon with killproc(8) and if this fails 
     197        ## set echo the echo return value. 
     198 
     199        killproc -TERM $DELUGED_WEB_BIN 
     200 
     201        # Remember status and be verbose 
     202        rc_status -v 
     203        ;; 
     204    try-restart) 
     205        ## Stop the service and if this succeeds (i.e. the  
     206        ## service was running before), start it again. 
     207        $0 status >/dev/null &&  $0 restart 
     208 
     209        # Remember status and be quiet 
     210        rc_status 
     211        ;; 
     212    restart) 
     213        ## Stop the service and regardless of whether it was 
     214        ## running or not, start it again. 
     215        $0 stop 
     216        $0 start 
     217 
     218        # Remember status and be quiet 
     219        rc_status 
     220        ;; 
     221    force-reload|reload) 
     222        ## Signal the daemon to reload its config. Most daemons 
     223        ## do this on signal 1 (SIGHUP). 
     224 
     225        echo -n "Reload service DELUGED_WEB" 
     226 
     227        killproc -HUP $DELUGED_WEB_BIN 
     228 
     229        rc_status -v 
     230 
     231        ;; 
     232    status) 
     233        echo -n "Checking for service DELUGED_WEB " 
     234        ## Check status with checkproc(8), if process is running 
     235        ## checkproc will return with exit status 0. 
     236 
     237        # Status has a slightly different for the status command: 
     238        # 0 - service running 
     239        # 1 - service dead, but /var/run/  pid  file exists 
     240        # 2 - service dead, but /var/lock/ lock file exists 
     241        # 3 - service not running 
     242 
     243        checkproc $DELUGED_WEB_BIN 
     244 
     245        rc_status -v 
     246        ;; 
     247    probe) 
     248        ## Optional: Probe for the necessity of a reload, 
     249        ## give out the argument which is required for a reload. 
     250 
     251        ;; 
     252    *) 
     253        echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" 
     254        exit 1 
     255        ;; 
     256esac 
     257rc_exit 
     258}}}