-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathREADME
87 lines (71 loc) · 3.45 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
cgminer-run
===========
Running cgminer on linux
This requires the linux screen command to be installed on your system
The command:
screen -ls
will probably enlighten you to the installation status of the screen command
and maybe even tell you how to install it, if it isn't already installed
If it isn't already installed, here's some hints on how to install it on
some linux versions:
On Ubuntu and derivatives:
apt-get install screen
On Pacman based systemd (e.g. Arch):
pacman -S screen
On Yum based systems (e.g. Fedora):
yum install screen
sem.c
-----
A program to keep a command of your choice always running on a linux computer
Simply create a script (see cgminer-cron.sh below), put it in crontab to
run every minute, and you're done
Compile with 'make sem'
cp -pv sem /usr/local/bin/
It will only allow the sem command in the cgminer-cron.sh to successfully
run cgminer.sh once at a time on a computer
Each other time sem is run, while the first one is still running, it will
immediately return and not start the cgminer.sh command
If cgminer.sh crashes, gets killed, or fails for some reason, it will release
sem's semaphore lock and the next run of cgminer-cron.sh after that, within
a minute, will start cgminer.sh again
The system lock used by sem is based on the inode of the semfile passed to sem
Two different invocations of sem with two different semfiles will produce
two different, independent locks that will not stop each other from running
Also, if you delete the semfile while one sem is still using it, and create a
new semfile of the same name and run sem with that new file, it will also
produce two different, independent locks
The touch command used in cgminer-cron.sh makes sure the semfile exists, but
doen't affect the lock produced, if the semfile does already exist
Since the lock is actually a semaphore, if the system should shutdown or
crash for any reason, the lock will certainly be released and the semfile
does not need to be cleaned up/deleted when the system restarts
cgminer-cron.sh
---------------
An example script to keep cgminer running
Read it and change it as necessary
Put it in /usr/local/bin
chmod +x /usr/local/bin/cgminer-cron.sh
If your linux has an /etc/crontab then you can add it to crontab as:
* * * * * root screen -d -m -S cgm /usr/local/bin/cgminer-cron.sh
(or replace root with whatever other account you want to run cgminer)
If you use cronie or some other cron implementation that has a per user crontab
then use the command to edit your crontab file (e.g. crontab -e) and add
* * * * * screen -d -m -S cgm /usr/local/bin/cgminer-cron.sh
If the cgminer screen (cgm) doesn't appear after a couple of minutes it will
usually mean a permission error or a file not in the correct place or not +x
You can usually see what the problem is by running cgminer-cron.sh and it
should spit out the error that is causing it to fail i.e. run:
/usr/local/bin/cgminer-cron.sh
then
screen -ls
should list a cgm screen - if there were no problems or errors
Note that permission issues may stop it from running if you are running it in
cron as a different user to what you are logged in as and the permissions are
not setup to allow that user for all scripts and programs being used
cgminer.sh
----------
A sample cgminer run script to keep cgminer running and logging output
into your home directory
You either need a ~/.cgminer/cgminer.conf file with your settings and pools or
edit cgminer.sh to add your settings and pools
Don't forget to chmod +x cgminer.sh