Author

Topic: UBUNTU 16.04 Help (Read 279 times)

newbie
Activity: 78
Merit: 0
April 18, 2018, 11:14:59 AM
#17
What NameTaken said is proper way to do it, except user services will be inside ~/.config/systemd/user/service.name. example (change user/group for your username, unless you need to xmr-stak running as root then place it inside /etc/systemd and don't specify any)
Code:
$vim ~/.config/systemd/user/xmr.service

[Unit]
Description=xmr-stak
After=network.target

[Service]
User=user
Group=user
Type=simple
RemainAfterExit=yes
ExecStart=/path/to/your/xmr-stak -c /path/to/config

[Install]
WantedBy=default.target

$systemctl --user enable xmr.service

ps: you can add tmux/screen if you need it -
Code:
ExecStart=/usr/bin/tmux new-session -d -s xmr /path/to/your/xmr-stak -c /path/to/config
member
Activity: 311
Merit: 69
PowerMining.pw
April 18, 2018, 11:09:53 AM
#16
Use screen and systemctl/systemd - works perfectly on my Ubuntu`s.
hero member
Activity: 630
Merit: 502
April 18, 2018, 11:01:10 AM
#15
Ubuntu as well as all major Linux distributions have adopted Systemd as the init system for service and log management. The proper way to start a service (miner) on boot is to create a service file in /etc/systemd/system/ then enable it.
hero member
Activity: 1036
Merit: 606
April 18, 2018, 10:55:14 AM
#14
You do not need root access to run a program at startup.

1/. Login under your user account, create a text file with gedit and add:

Code:
#!/bin/sh
xterm -hold -e "cd /home// && ./xmr-stak --"

2/. Save the file as xmr-stak_Launch.sh in the root of your home directory.

3/. Open terminal and make the script executable by your user:

Code:
chmod +x /home//xmr-stak_Launch.sh

4/. Open the Ubuntu Dash, search for "Startup Applications" and click on it.

5/. In the "Add Startup Application" window add:

Name: XMR-STAK
Command: Browse to the xmr-stak_Launch.sh file in the root of your home directory and click 'Add'

XMR-STAK  should now launch after your login to Ubuntu. If you want to add a delay before starting the application, open the starutp file located in:

Code:
~/.conf/autostart/XMR-STAK.sh.desktop

with gedit  and add a delay to the file:

Code:
[Desktop Entry]
Type=Application
Exec=/home//xmr-stak_Launch.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
X-GNOME-Autostart-Delay=
Name[en_US]=XMR-STAK
Name=XMR-STAK
Comment[en_US]=
Comment=



member
Activity: 113
Merit: 10
April 18, 2018, 09:05:35 AM
#13
Also, FWIW, The easiest method to try it out is to download the ISO and the burn the ISO image on to a CD (not copy).

Boot from the CD and then try it out. If you like it then use "Puppy Installer" to install it to a USB flash drive.

I recommend re-partitioning the flash drive as ext4 before you install it though. It is a much more durable filesystem for rigs that can crash regularly and often. I also recommend you use USB3 flash drives. They are speedier, even in USB2 ports.
member
Activity: 113
Merit: 10
April 18, 2018, 08:28:27 AM
#12
I just PM'd you my number.

I have all my rigs set to boot from flash drives. None of them have or need hard drives.

I use sandisk 32gb drives. I get them on ebay for ~$13 each.

Updating becomes pretty easy peasy after that. Cloning is done in minutes also. But you will have edit /ect/hostname before you boot up the new cloned system so you don't conflict with the existing system.
hero member
Activity: 714
Merit: 512
April 18, 2018, 08:16:05 AM
#11
Try /etc/rc.d also if you have it.

Unfortunately, I have zero experience with "user" based linux. All my experience is with root based linux via puppy linux.  The version I am using is Xenialpup 64.

Not sure if the link below will work but here goes:

http://murga-linux.com/puppy/viewtopic.php?t=109476

It is based on Ubuntu Xenial 64 but "puppy trained" to load up as root. The iso is only 330 meg. If you want to compile any apps then you will need the 198 meg "Devx" sfs also. If you can't figure out how to start Ubuntu as root, maybe give it a whirl?

I may have to... Unbuntu is making me crazy with trying to make this work.

Unfortunately that means re-installing Linux on 25 machines, hah.
member
Activity: 113
Merit: 10
April 18, 2018, 08:13:52 AM
#10
Try /etc/rc.d also if you have it.

Unfortunately, I have zero experience with "user" based linux. All my experience is with root based linux via puppy linux.  The version I am using is Xenialpup 64.

Not sure if the link below will work but here goes:

http://murga-linux.com/puppy/viewtopic.php?t=109476

It is based on Ubuntu Xenial 64 but "puppy trained" to load up as root. The iso is only 330 meg. If you want to compile any apps then you will need the 198 meg "Devx" sfs also. If you can't figure out how to start Ubuntu as root, maybe give it a whirl?
hero member
Activity: 714
Merit: 512
April 18, 2018, 08:06:00 AM
#9
Well... I can get into the ROOT from my terminal but cannot get the system to login as root from the get-go.

*ugh*
hero member
Activity: 714
Merit: 512
April 18, 2018, 07:50:45 AM
#8
Alrighty... so I made the script inside "init" -- and it doesn't start at login.

I am trying "init.d" here in just a minute.

The script itself works if I execute it with "sudo"... but the problem may be that I don't seem to be ROOT on the system. And I honestly don't see an option to assign that to my user.

Also no go in the "init.d" folder.

That being said... it APPEARS that for the "root" login to work on UBUNTU you have to type in the password every time at login. Based on what Google has shown me so far... I guess I will try it out and see -- it won't save me alot of headache unless the system just logs back in on it's own after a power loss event. If I need to type in a password I'll STILL have to go to each system one-by-one.
hero member
Activity: 714
Merit: 512
April 18, 2018, 07:39:15 AM
#7
Alrighty... so I made the script inside "init" -- and it doesn't start at login.

I am trying "init.d" here in just a minute.

The script itself works if I execute it with "sudo"... but the problem may be that I don't seem to be ROOT on the system. And I honestly don't see an option to assign that to my user.
member
Activity: 113
Merit: 10
April 16, 2018, 09:39:45 PM
#6
A few more details about the above instructions....

1. This presumes you *are* logging in as root
2. I just remembered I run my script *after* starting X-windows. If you do the same, then save StartStak.sh to your directory that that runs programs after loading X (for me it is /root/Startup)
3. If you want to run from the command prompt instead then replace the line:

Code:
urxvt -title XMR -e ./xmr-stak

with

Code:
./xmr-stak


in the StartStak.sh file.

4. Also, if you want to run from the command prompt instead and your linux does not have /etc/init, then it may have /etc/init.d or etc/rc.d they will also run scripts on startup as well.

I personally prefer the Puppy Linux way of doing things, automatically starting as root and loading X as it is similar to windows. So it allows me to automatically load my miner program after a reboot without me ever touching the keyboard. I am sure other linux's can setup the same way. I just found this as the path of least resistance for me.

HTH

Overdrive5
hero member
Activity: 714
Merit: 512
April 14, 2018, 10:41:34 AM
#5
Thanks for the help! =)
member
Activity: 113
Merit: 10
April 14, 2018, 09:24:53 AM
#4
Hello ~

1st post on this forum. Have been a long time lurker and finally found a question I felt I could contribute and give back to the community.

Sundownz, copy,edit and save the example script below in /etc/init/ as something like StartStak.sh

After you saved it, chmod it to 755 . This will allow it to be executable.



Code:
#!/bin/bash

# leave the line above untouched, it is needed for any bash scripts
# The # starting any lines below means it is a commented line, so don't execute

# You *must* edit the line below to change directory to your directory of your xmr-stak executable

cd /home/xmr/xmr-stak/bin

# Assuming a fresh reboot, Wait 60 seconds for internet to become available. edit as needed.
sleep 60

# do a loop to run xmr-stak and log any crashes.

while :
do

# My Puppy Linux Xenial Ubuntu derivative uses urxvt terminal program. Not sure if your O/S has it. Edit as needed.

urxvt -title XMR -e ./xmr-stak

# I use the below line to log Miner Restarts to monitor for any crashes

echo $(date) XMR Miner restart >>~/MinerRestart.log
done 



PS. When you get a chance, check out puppy linux. It's a nice sub 1GB flashdrive loadable linux that I have been using for over 12 years. I have always liked their philosophy of compact speedy root linux's. They come in several tasty flavors such as Ubuntu, Slackware and many others.

Hope this is helpful.... Smiley

OverDrive5

hero member
Activity: 714
Merit: 512
April 14, 2018, 07:50:52 AM
#3
Thanks I'll try some of those methods. Running these servers is my first Linux experience.
full member
Activity: 279
Merit: 104
April 14, 2018, 07:26:09 AM
#2
Have a look at this

https://askubuntu.com/questions/814/how-to-run-scripts-on-start-up

As you can see there are several methods.
hero member
Activity: 714
Merit: 512
April 14, 2018, 07:13:41 AM
#1
I am running several Dell R815 servers to mine Monero.

I have installed UBUNTU Linux 16.04 on these machines.

I have XMR-STAK running no problem at all -- works great... get ~2kH per system.

BUT I have not been able to successfully get XMR-STAK or any program, for that matter, to start up with the OS.

There is a GUI section in UBUNTU that you can add Startup programs... or so it says... but it doesn't work.
Jump to: