Im runnung Debian 6...
I gave up messing with init scripts that start screen sessions and put this in my /etc/rc.local instead
su - user -c "/path/to/cgminer/start/script.sh"
Oh, and i use command line arguments, because either on windows or linux, even after saving the config, it ignores me
(cgminer always asks for input)
This is usually because you have a syntax error in your config. You can see what the errors are if you specify the config.
cgminer -c ~/.cgminer/cgminer.conf
I don't know why it is built this way. IMO, when you fail to parse a config, you should fail out, not act like there was no config.
Thx about the config, i fixed it, much nicer now XD
--
Putting
su - rcocchiararo -c "/home/rcocchiararo/bitcoin/startcg.sh"
in rc.local seems to do nothing.
Running that from a "root terminal" (inside rcocchiararo GUI loggin) nets me a CPU mining session
[2012-02-05 12:18:17] Error: Getting Device IDs (num)
[2012-02-05 12:18:17] clDevicesNum returned error, none usable
[2012-02-05 12:18:17] Started cgminer 2.1.2
My script has:
#!/bin/bash
export AMDAPPSDKROOT=/opt/AMD-APP-SDK-v2.4-lnx32/
export AMDAPPSDKSAMPLESROOT=/opt/AMD-APP-SDK-v2.4-lnx32/
export LD_LIBRARY_PATH=${AMDAPPSDKROOT}lib/x86:${LD_LIBRARY_PATH}
export DISPLAY=:0
cgminer 2>>/var/log/cgminer.log
Maybe something from my "exports" is not ok ? i mean, just running "cgminer" from a terminal with my user (rcocchiararo) makes it work. (i once had the exports in .bashrc, but i no longer do).
also, i believe, at least on my debian system, it wont work to have that in rc.local, because it would be similar to double clicking my script and telling it to "run" instead of "run in terminal". If i do that, this is what happens:
[2012-02-05 12:02:55] Started cgminer 2.1.2
[2012-02-05 12:02:56] Long-polling activated for http://pit.deepbit.net:8332/listenChannel
Error opening terminal: unknown.
I tried using rc.local to launch screen, but similar things happen, i THINK i got it to run, but it was only with CPU (manually i can confirm it, unless i run it from my users terminal).
Maybe the fact that root is unable to login with GUI in debian (at least debian 6) causes cgminer some headaches ?
I tried:
su - rcocchiararo -c "/usr/bin/screen -dmS Miner /home/rcocchiararo/bitcoin/startcg.sh rcocchiararo"
Still, the last "rcocchiararo" seems to do nothing, because i changed that to "pepe" and i even ran:
/usr/bin/screen -dmS Miner /home/rcocchiararo/bitcoin/startcg.sh pepe
And the user who was running cgminer according to "top" was the one who launched the command (rcocchiararo, not pepe).
Im runnung Debian 6
With the following script, i understand that i get the same thing you indicated:
#! /bin/sh
### BEGIN INIT INFO
# Provides: cgminer
# Required-Start: $all
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mining
# Description: Start BTC Mining
### END INIT INFO
script
sleep 15
cd /home/rcocchiararo/bitcoin
exec /usr/bin/screen -dmS Miner su -c /home/rcocchiararo/bitcoin/startcg.sh rcocchiararo
end script
This won't work as a sh script because the script keyword is an Upstart conf file function. You would want to take out both script/end script. I don't know offhand if Debian has Upstart but if it does then the best practice would be to use that by putting this as a conf file in /etc/init. If it doesn't then you could rewrite it as a script by removing the "script / end script" and taking out exec so it just calls screen. I don't think exec is a sh command either. Upstart conf file is not the same as a script.
The cgminer config writer doesn't write a fully working config unfortunately. You have to tweak some values - particularly zero ones. My version here does actually write a working config even with engine/memory values that work. But my version of the code is considered too dangerous by ckolivas to include in the mainline since it reads current ADL values to put in the config. There may be instances/cards where it causes problems - for my 5830s it works ok.
I thought that might be the case, thats why i tried with and without script/exec, and i still failed
-------------
EDIT: success!
Finally, by setting a "startup application" to run:
/usr/bin/screen -dmS Miner /home/rcocchiararo/bitcoin/startcg.sh rcocchiararo
Now my home server mines after rcocchiararo auto logins (that was already configured, but without screen, i had the "no terminal" issue.