# Run Grin (Grin's shared lib) on boot up? \[Linux\]

**URL:** <https://forum.grin.mw/t/run-grin-grins-shared-lib-on-boot-up-linux/2025>\
**Category:** Mining\
**Created:** [January 12, 2019, 11:03am UTC](https://forum.grin.mw/t/run-grin-grins-shared-lib-on-boot-up-linux/2025 "2019-01-12T11:03:14Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![AskSatoshi](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.grin.mw/asksatoshi/32/837_2.png) [@AskSatoshi](https://forum.grin.mw/u/AskSatoshi)\
**Post date:** [January 12, 2019, 11:03am UTC](https://forum.grin.mw/t/run-grin-grins-shared-lib-on-boot-up-linux/2025/1 "2019-01-12T11:03:14Z")

</div>

From what I’ve understood, `./target/release/grin-miner` runs shared-library which executes `grin-miner.toml` in `mwgrinpool/grin-miner` I’d would like to run this automatically on boot up… Any ideas?

---

<div class="post-metadata">

**Author:** ![dewminer76](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@dewminer76](https://forum.grin.mw/u/dewminer76)\
**Post date:** [January 12, 2019, 11:53am UTC](https://forum.grin.mw/t/run-grin-grins-shared-lib-on-boot-up-linux/2025/2 "2019-01-12T11:53:09Z")

</div>

read my guide for linux here [AMD grin-miner error](https://forum.grin.mw/t/amd-grin-miner-error/2020/2)  
grin-miner.toml is a configuration file for grin-miner  
to run the miner automatically after reboot, create a start script like this (it is using tmux to be able to attach back to grin-miner tui):

#!/bin/bash  
tmux new-session -d -n mining  
tmux send-keys -t mining “cd /opt/grin-miner” C-m  
tmux send-keys -t mining “./grin-miner” C-m

and call the script from root’s crontab (crontab -e)  
@reboot /root/startmining.sh

---

<div class="post-metadata">

**Author:** ![AskSatoshi](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.grin.mw/asksatoshi/32/837_2.png) [@AskSatoshi](https://forum.grin.mw/u/AskSatoshi)\
**Post date:** [January 14, 2019, 9:25am UTC](https://forum.grin.mw/t/run-grin-grins-shared-lib-on-boot-up-linux/2025/3 "2019-01-14T09:25:19Z")

</div>

My script looks like this:

```
#!/bin/bash
tmux new-session -d -n mining
tmux send-keys -t mining “cd /home/<user>/mwgrinpool/grin-miner” C-m
tmux send-keys -t mining “./target/release/grin-miner” C-m

```

And it’s saved on my Desktop as “grin.sh”

Once I open crontab, I’m being redirected to temporary file for crontab, where I’ve place the following line… Either trying to run the script directly or on the boot, it won’t run. Any idea what I’m doing wrong?

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/grin/original/1X/8a99451e5b57c9a69312a7bc7343cb9b20e7a61d.png)

I granted chmod +x permissions and removed all suspicious characters.

---

<div class="post-metadata">

**Author:** ![dewminer76](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@dewminer76](https://forum.grin.mw/u/dewminer76)\
**Post date:** [January 14, 2019, 10:29am UTC](https://forum.grin.mw/t/run-grin-grins-shared-lib-on-boot-up-linux/2025/4 "2019-01-14T10:29:07Z")

</div>

1.) i would change the script the way, that the miner will run with root privileges.  
but, to be able to run the script as root without entering the password for root, your user needs to be specified in /etc/sudoers file.

> #Allow members of group sudo to execute any command  
> %sudo ALL=(ALL:ALL) ALL  
> youruser ALL=(ALL) NOPASSWD:ALL

2.) the grin.sh should look like this

> #!/bin/bash  
> tmux new-session -d -n mining  
> tmux send-keys -t mining “cd $HOME/mwgrinpool/grin-miner” C-m  
> tmux send-keys -t mining “sudo ./target/release/grin-miner” C-m

3.) and the correct crontab entry

> @reboot $HOME/Desktop/grin.sh

---

<div class="post-metadata">

**Author:** ![AskSatoshi](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.grin.mw/asksatoshi/32/837_2.png) [@AskSatoshi](https://forum.grin.mw/u/AskSatoshi)\
**Post date:** [January 14, 2019, 12:10pm UTC](https://forum.grin.mw/t/run-grin-grins-shared-lib-on-boot-up-linux/2025/5 "2019-01-14T12:10:27Z")

</div>

I can’t neither change the permissions nor open the sudoers file

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/grin/original/1X/e6e72bb53c77e0c8091fc2326e503e9837961d01.png)

---

<div class="post-metadata">

**Author:** ![dewminer76](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@dewminer76](https://forum.grin.mw/u/dewminer76)\
**Post date:** [January 14, 2019, 1:02pm UTC](https://forum.grin.mw/t/run-grin-grins-shared-lib-on-boot-up-linux/2025/6 "2019-01-14T13:02:59Z")

</div>

in CLI use command sudo visudo to edit the /etc/sudoers file

---

<div class="post-metadata">

**Author:** ![zphou](https://avatars.discourse-cdn.com/v4/letter/z/54ee81/32.png) [@zphou](https://forum.grin.mw/u/zphou)\
**Post date:** [January 21, 2019, 12:53pm UTC](https://forum.grin.mw/t/run-grin-grins-shared-lib-on-boot-up-linux/2025/7 "2019-01-21T12:53:52Z")

</div>

suggest to use systemd to start the miner directly, if you want to check the log of it, you can see it with journalctl as well. systemd will bring extra bonus which would monitor your miner process and restart it if it dies.
