当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 2 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : Bumblebee服务怎么没有自动启动?
帖子发表于 : 2013-03-23 23:55 

注册: 2013-03-23 23:48
帖子: 1
系统: linux mint
送出感谢: 0 次
接收感谢: 0 次
每次都要sudo service bumblebee start,要不然optirun就会提示bumblebee daemon没启动

代码:
YYH-PC init # cat bumblebeed.conf
# Upstart job for Bumblebee daemon

description "Bumblebee supporting nVidia Optimus cards"
author      "Lekensteyn <lekensteyn@gmail.com>"

# XXX: do we need to stop before / after a graphical DE like kdm?
start on    (login-session-start or desktop-session-start)
stop on     (desktop-shutdown)

# restart in case it crashed for some reason
respawn

script
   libopts=

   # When the user installs a nvidia package that is unknown,
   # ignore the paths in bumblebee.conf and use detected ones
   if ! driver=$(grep -Po '^Driver=\K.*' /etc/bumblebee/bumblebee.conf) \
      || [ -z "$driver" ] || [ "$driver" = "nvidia" ]; then
      # find LibraryPath setting of nvidia section
      libpath=$(awk -F[=:] '/^\[driver-nvidia\]/{d=1}/^LibraryPath=/{if(d){print $2;exit}}' \
         /etc/bumblebee/bumblebee.conf) || true

      # pick the first available nvidia installation (not necessary
      # the latest, e.g. nvidia-current over nvidia-experimental-310)
      pkgname=$(ls -1d /usr/lib/nvidia*/libGL.so | cut -d/ -f4 | head -1) || true

      # When the default library path does not contain nvidia drivers,
      # it is possibly not installed. If no driver is installed (no
      # /usr/lib/nvidia-*), assume that the auto-detection will use
      # nouveau instead and do not override paths.
      if [ ! -e "$libpath/libGL.so" -a -n "$pkgname" ] && \
         modprobe -nq "$pkgname"; then
         # assume nvidia driver even if nouveau is already loaded
         libopts="$libopts --driver nvidia"
         libopts="$libopts --driver-module $pkgname"
         libopts="$libopts --ldpath /usr/lib/$pkgname:/usr/lib32/$pkgname"
         libopts="$libopts --module-path /usr/lib/$pkgname/xorg,/usr/lib/xorg/modules"
      fi
   fi

   # don't use --daemon as Upstart gets confused by that.
   exec '/usr/sbin/bumblebeed' --use-syslog $libopts
end script


代码:
YYH-PC init.d # cat bumblebeed
#!/bin/sh -e
# upstart-job
#
# Symlink target for initscripts that have been converted to Upstart.

set -e

INITSCRIPT="$(basename "$0")"
JOB="${INITSCRIPT%.sh}"

if [ "$JOB" = "upstart-job" ]; then
    if [ -z "$1" ]; then
        echo "Usage: upstart-job JOB COMMAND" 1>&2
   exit 1
    fi

    JOB="$1"
    INITSCRIPT="$1"
    shift
else
    if [ -z "$1" ]; then
        echo "Usage: $0 COMMAND" 1>&2
   exit 1
    fi
fi

COMMAND="$1"
shift


if [ -z "$DPKG_MAINTSCRIPT_PACKAGE" ]; then
   ECHO=echo
else
   ECHO=:
fi

$ECHO "Rather than invoking init scripts through /etc/init.d, use the service(8)"
$ECHO "utility, e.g. service $INITSCRIPT $COMMAND"

# Only check if jobs are disabled if the currently _running_ version of
# Upstart (which may be older than the latest _installed_ version)
# supports such a query.
#
# This check is necessary to handle the scenario when upgrading from a
# release without the 'show-config' command (introduced in
# Upstart for Ubuntu version 0.9.7) since without this check, all
# installed packages with associated Upstart jobs would be considered
# disabled.
#
# Once Upstart can maintain state on re-exec, this change can be
# dropped (since the currently running version of Upstart will always
# match the latest installed version).

UPSTART_VERSION_RUNNING=$(initctl version|awk '{print $3}'|tr -d ')')

if dpkg --compare-versions "$UPSTART_VERSION_RUNNING" ge 0.9.7
then
    initctl show-config -e "$JOB"|grep -q '^  start on' || DISABLED=1
fi

case $COMMAND in
status)
    $ECHO
    $ECHO "Since the script you are attempting to invoke has been converted to an"
    $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB"
    $COMMAND "$JOB"
    ;;
start|stop)
    $ECHO
    $ECHO "Since the script you are attempting to invoke has been converted to an"
    $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB"
    if status "$JOB" 2>/dev/null | grep -q ' start/'; then
        RUNNING=1
    fi
    if [ -z "$RUNNING" ] && [ "$COMMAND" = "stop" ]; then
        exit 0
    elif [ -n "$RUNNING" ] && [ "$COMMAND" = "start" ]; then
        exit 0
    elif [ -n "$DISABLED" ] && [ "$COMMAND" = "start" ]; then
        exit 0
    fi
    $COMMAND "$JOB"
    ;;
restart)
    $ECHO
    $ECHO "Since the script you are attempting to invoke has been converted to an"
    $ECHO "Upstart job, you may also use the stop(8) and then start(8) utilities,"
    $ECHO "e.g. stop $JOB ; start $JOB. The restart(8) utility is also available."
    if status "$JOB" 2>/dev/null | grep -q ' start/'; then
        RUNNING=1
    fi
    if [ -n "$RUNNING" ] ; then
        stop "$JOB"
    fi
    # If the job is disabled and is not currently running, the job is
    # not restarted. However, if the job is disabled but has been forced into the
    # running state, we *do* stop and restart it since this is expected behaviour
    # for the admin who forced the start.
    if [ -n "$DISABLED" ] && [ -z "$RUNNING" ]; then
        exit 0
    fi
    start "$JOB"
    ;;
reload|force-reload)
    $ECHO
    $ECHO "Since the script you are attempting to invoke has been converted to an"
    $ECHO "Upstart job, you may also use the reload(8) utility, e.g. reload $JOB"
    reload "$JOB"
    ;;
*)
    $ECHO
    $ECHO "The script you are attempting to invoke has been converted to an Upstart" 1>&2
    $ECHO "job, but $COMMAND is not supported for Upstart jobs." 1>&2
    exit 1
esac


页首
 用户资料  
 
2 楼 
 文章标题 : Re: Bumblebee服务怎么没有自动启动?
帖子发表于 : 2013-03-24 0:04 
头像

注册: 2010-06-16 1:05
帖子: 14668
地址: Tencent
系统: Mac OS X
送出感谢: 1
接收感谢: 153
没加到自启动里?实在不行把这个写到rc.local里吧


_________________
twitter求fo:http://twitter.com/maplebeats
博客求踩:http://maplebeats.com


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 2 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 3 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译