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

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?

read my guide for linux here AMD grin-miner error
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

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?

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

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

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

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

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.