Changes between Version 10 and Version 11 of UserGuide/Service


Ignore:
Timestamp:
04/01/2010 06:23:22 AM (14 years ago)
Author:
.faust
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UserGuide/Service

    v10 v11  
    672672rc_exit 
    673673}}} 
     674 
     675=== !FreeBSD Init Script === 
     676 
     677==== Deluged ==== 
     678 
     679{{{ 
     680#!/bin/sh 
     681# 
     682#  deluged RCng startup script 
     683#  created by: R.S.A. aka .faust  
     684#            mail: rsa dot aka dot f at gmail dot com 
     685#  
     686  
     687# PROVIDE: deluged 
     688# REQUIRE: NETWORKING SERVERS DAEMON ldconfig resolv 
     689# BEFORE: LOGIN 
     690# KEYWORD: shutdown 
     691  
     692# Add the following line to /etc/rc.conf.local or /etc/rc.conf to enable deluged at startup 
     693#       deluged_enable="YES" 
     694# 
     695# pidfile  (str):            Specify the full path to the PID file 
     696# log (str):                    Specify the full path to the LOG file 
     697# delugew_user (str):  Set to user running deluge-web 
     698# cfg_dir (str):            Specify the full path to directory with deluge config files 
     699# 
     700#  Warning! Rights to folders and files must be "rwx" for the user under which the run deluge  
     701  
     702. /etc/rc.subr 
     703  
     704name="deluged" 
     705rcvar=`set_rcvar` 
     706  
     707load_rc_config $name 
     708deluged_enable=${deluged_enable:=NO} 
     709 
     710log="/home/deluge/${name}.log" 
     711pidfile="/home/deluge/${name}.pid" 
     712cfg_dir="/home/deluge/config/" 
     713deluged_user="nobody" 
     714 
     715required_dirs=${cfg_dir} 
     716 
     717command_interpreter="/usr/local/bin/python" 
     718command="/usr/local/bin/${name}" 
     719start_cmd="${name}_start" 
     720 
     721deluged_start() 
     722{ 
     723if [ ! -f "${pidfile}" ]; then 
     724    su -m ${deluged_user} -c "/usr/local/bin/${name} -c ${cfg_dir} -l ${log} -P ${pidfile}" 
     725    echo "Starting ${name}." 
     726else 
     727    GETPROCESSPID=`/bin/ps -auxw | /usr/bin/awk '/deluged/ && !/awk/ && !/sh/ {print $2}'` 
     728    PIDFROMFILE=`cat ${pidfile}` 
     729    if [ "$GETPROCESSPID" = "$PIDFROMFILE" ]; then 
     730        echo "${name} already running with PID: ${PIDFROMFILE} ?"   
     731        echo "Remove ${pidfile} manually if needed." 
     732    else 
     733        rm -f ${pidfile} 
     734        su -m ${deluged_user} -c "/usr/local/bin/${name} -c ${cfg_dir} -l ${log} -P ${pidfile}" 
     735        echo "Starting ${name}." 
     736    fi 
     737fi 
     738} 
     739  
     740  
     741run_rc_command "$1" 
     742}}} 
     743 
     744==== Web UI ==== 
     745 
     746{{{ 
     747#!/bin/sh 
     748# 
     749#  deluge-web RCng startup script 
     750#  created by: R.S.A. aka .faust  
     751#            mail: rsa dot aka dot f at gmail dot com 
     752#  
     753  
     754# PROVIDE: delugew 
     755# REQUIRE: NETWORKING SERVERS DAEMON ldconfig resolv 
     756# BEFORE: LOGIN 
     757# KEYWORD: shutdown 
     758  
     759# Add the following line to /etc/rc.conf.local or /etc/rc.conf to enable deluge-web at startup 
     760#       delugew_enable="YES" 
     761# 
     762# pidfile  (str):            Specify the full path to the PID file 
     763# log (str):                    Specify the full path to the LOG file 
     764# delugew_user (str):  Set to user running deluge-web 
     765# cfg_dir (str):            Specify the full path to directory with deluge config files 
     766# 
     767#  Warning! Rights to folders and files must be "rwx" for the user under which the run deluge  
     768. /etc/rc.subr 
     769  
     770name="delugew" 
     771rcvar=`set_rcvar` 
     772  
     773load_rc_config $name 
     774delugew_enable=${delugew_enable:=NO} 
     775 
     776log="/home/deluge/${name}.log" 
     777pidfile="/home/deluge/${name}.pid" 
     778cfg_dir="/home/deluge/config/" 
     779delugew_user="nobody" 
     780 
     781required_dirs=${cfg_dir} 
     782 
     783command_interpreter="/usr/local/bin/python" 
     784command="/usr/local/bin/deluge-web" 
     785start_cmd="${name}_start" 
     786start_postcmd="${name}_poststart" 
     787 
     788delugew_start() 
     789{ 
     790if [ ! -f "${pidfile}" ]; then 
     791    su -m ${delugew_user} -c "/usr/local/bin/deluge-web -f -c ${cfg_dir} -l ${log}" 
     792    echo "Starting ${name}." 
     793else 
     794    GETPROCESSPID=`/bin/ps -auxw | /usr/bin/awk '/deluge-web/ && !/awk/ && !/sh/ {print $2}'` 
     795    PIDFROMFILE=`cat ${pidfile}` 
     796    if [ "$GETPROCESSPID" = "$PIDFROMFILE" ]; then 
     797        echo "${name} already running with PID: ${PIDFROMFILE} ?"   
     798        echo "Remove ${pidfile} manually if needed." 
     799    else 
     800        rm -f ${pidfile} 
     801        su -m ${delugew_user} -c "/usr/local/bin/deluge-web -f -c ${cfg_dir} -l ${log}" 
     802        echo "Starting ${name}." 
     803    fi 
     804fi 
     805} 
     806  
     807delugew_poststart() 
     808{ 
     809echo `/bin/ps -auxw | /usr/bin/awk '/deluge-web/ && !/awk/ {print $2}'` > $pidfile 
     810} 
     811  
     812run_rc_command "$1" 
     813}}}