Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 10-09-08, 07:10 AM   #1
hvw59601
Registered User
 
Join Date: Oct 2004
Posts: 34
Default nvidia-settings script as daemon

Hi,

I had this idea to run a script with nvidia-settings as a background daemon to record the GPU temp. But when I do as root in a vt something like:

nvidia-settings -c 0:0.0 --query [gpu:0]/GPUCoreTemp

I get:

ERROR: Cannot open display '0:0.0'.

Of course under X logged on as user when I do:

nvidia-settings --query [gpu:0]/GPUCoreTemp

I get:

Attribute 'GPUCoreTemp' (debian:0[gpu:0]): 34.

Has anybody heard of running nvidia-settings in the background?

Hugo
hvw59601 is offline   Reply With Quote
Old 10-09-08, 11:39 AM   #2
oyvind
Registered User
 
Join Date: May 2004
Location: Norway
Posts: 117
Default Re: nvidia-settings script as daemon

Well, it's certainly possible to do.

Here's some shell-script code which allows you to connect to a running X-server from a daemon script outside of the X-server:
Code:
#!/bin/sh

# For all open X displays, set up the X-display's environment
# (DISPLAY and XAUTHORITY variables).
# This code does not need to be run from within an X-session.
for dispsocket in /tmp/.X11-unix/X*; do
    dispnum="${dispsocket#/tmp/.X11-unix/X}"

    # Find out who is logged on to the display
    dispuser=`who|grep "(:$dispnum)"|awk '{print $1}'`

    # Find home directory of user
    homedir=`getent passwd $dispuser|cut -d: -f6`

    # Set up XAUTHORITY
    XAUTHORITY=
    [ -n "$homedir" ] && XAUTHORITY="$homedir/.Xauthority"
    export XAUTHORITY

    # Set up display variable (always needed)
    export DISPLAY=":$dispnum"

    # Run commands/clients which need to talk to the running X-server here.
    # Use 'su $dispuser -c "command"' if this script runs as root, and should
    # run the command on behalf the user currently logged into X.

    # $ nvidia-settings -q foobar
    xdpyinfo # example, print info about X server
done
The idea was taken from a certain Catalyst/fglrx ACPI shell-script which changes the GPU power mode on ACPI events, and which is obviously called from outside of running X context (like from the ACPI daemon). Use this at own risk, no guarantees and all that .
oyvind is offline   Reply With Quote
Old 10-09-08, 11:49 AM   #3
hvw59601
Registered User
 
Join Date: Oct 2004
Posts: 34
Default Re: nvidia-settings script as daemon

Great! Let me give that a whirl!

Hugo
hvw59601 is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help Installing NVIDIA Tesla M2070Q in Linux RHEL5 Ferianto85 NVIDIA Linux 0 05-18-12 09:35 PM
Found Simpsons in NVIDIA registry settings! ShVen NVIDIA GeForce 7, 8, And 9 Series 6 10-06-02 10:26 PM
rh7.3 and nvidia vcrispo NVIDIA Linux 11 07-31-02 09:57 PM

All times are GMT -5. The time now is 12:05 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.