Greetings
I have 2 goals here
1)
Immediate - Properly enable nvidia-persistenced daemon
2)
Long Term - Understand Slackware init better
Info - I'm running Slackware v14.0 32 bit with GTX 760 on proprietary driver NVIDIA 352.41
This driver and many other newer ones has the ability to specify settings on a per user basis or globally. They provide a daemon, nvidia-persistenced, which is accompanied by 2 scripts, a make and script for the daemon and an init install script which searches for an init it understands, specifically SysV, systemd, and Upstart.
For SysV it naturally seeks /etc/init.d to install the start script. They provide a template as well as one generated for SysV, Below is the generatwed onwe from my system.
Code:
#!/bin/sh -e
#
# NVIDIA Persistence Daemon Init Script
#
# Copyright (c) 2013 NVIDIA Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# This is a sample System V init script, designed to show how the NVIDIA
# Persistence Daemon can be started.
#
# This sample does not rely on any init system functions, to ensure the
# widest portability possible.
#
# chkconfig: 2345 99 01
# description: Starts and stops the NVIDIA Persistence Daemon
# processname: nvidia-persistenced
#
### BEGIN INIT INFO
# Provides: nvidia-persistenced
# Required-Start: $ALL
# Required-Stop: $ALL
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Starts and stops the NVIDIA Persistence Daemon
### END INIT INFO
NVPD=nvidia-persistenced
NVPD_BIN=/usr/bin/${NVPD}
NVPD_RUNTIME=/var/run/${NVPD}
NVPD_PIDFILE=${NVPD_RUNTIME}/${NVPD}.pid
NVPD_USER=nvidia-persistenced
if [ -f ${NVPD_PIDFILE} ]; then
read -r NVPD_PID < "${NVPD_PIDFILE}"
# Remove stale runtime files
if [ "${NVPD_PID}" ] && [ ! -d /proc/${NVPD_PID} ]; then
unset NVPD_PID
rm -rf "${NVPD_RUNTIME}"
fi
fi
case "${1}" in
start)
echo "Starting NVIDIA Persistence Daemon"
# Execute the daemon as the intended user
${NVPD_BIN} --user ${NVPD_USER}
;;
stop)
echo "Stopping NVIDIA Persistence Daemon"
# Stop the daemon - its PID should have been read in
[ ! -z "${NVPD_PID}" ] && kill ${NVPD_PID} &> /dev/null
;;
restart)
$0 stop
sleep 2
$0 start
;;
*) echo "usage: $0 {start|stop|restart}"
esac
exit 0
On my box /etc/init.d says it is a symlink to /etc/rc.d/init.d which does not exist, or didn't until today. Even when it didn't exist there were a few files in /etc/init.d but I'm quite certain they are of no consequence as 2 are text files, "functions" and "functions.README", and "vncserver.disabled".
So I created /etc/rc.d/init.d and copied the "nvidia-persistence.d" above to that directory. It does not work. The daemon is not started with the system.
Also included with the driver is an install script to install the executable "nvidia-persistence.d" to "/usr/bin" which I installed.
It seems to me I could just call the executable in any named init, such as rc.local but it would lack the start or stop confirmation messages.
So the problem is that there seem to be many ways to start this daemon and I'd like to know which is the proper "Slackware Way" as well as comments on whether or not it is a good idea to have /etc/rc.d/init.d for those apps that offer to use it properly?
Additionally nvidia-settings can create an nvidia-persistence.rc file which does a similar job. Any comments on best method much appreciated.
Thanks in advance