Run self compiled executable

MrJoki007

Dabbler
Joined
Jul 15, 2018
Messages
45
Hello,

whats the best way of permanently runnung a self compiled binary in truenas?
I need it to autorun on startup and always run in background.
Currently im running it in a debian vm on my windows machine, but i want to transfer it to my truenas scale server.

Thank you
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
Depending on how you need to manage it while it runs, it may be best to start it with tmux, so it can be accessed/viewed and/or managed while running and will not be subject to stopping if the middleware crashes.

You would set up a startup/init command.

Like this:
tmux new-session -d -s myexecutable '/mnt/pool/dataset/executable'
 

ChrisRJ

Wizard
Joined
Oct 23, 2020
Messages
1,919
Was this compiled on a system that uses the exact same shared libs as TrueNAS Scale? Or does this binary not use shared libs at all? Can you be more specific what program or kind of program we are talking about?

You did, by the way, not specify whether we are talking about TrueNAS Core or Scale or what version.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
You did, by the way, not specify whether we are talking about TrueNAS Core or Scale or what version
It's posted in the SCALE sub-forum, so that can be considered as specified. Exact version might be helpful, but probably won't change a lot.
 

ChrisRJ

Wizard
Joined
Oct 23, 2020
Messages
1,919
It's posted in the SCALE sub-forum, so that can be considered as specified
Sorry, I had overlooked that, since I only read posts via the "What's new" link. Will look more carefully from now on. Thanks!
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
I had overlooked that, since I only read posts via the "What's new" link. Will look more carefully from now on. Thanks!
It used to get me every time for quite a while, so now I'm used to looking at the top of every post to check.
 

Whattteva

Wizard
Joined
Mar 5, 2013
Messages
1,824
whats the best way of permanently runnung a self compiled binary in truenas?
I need it to autorun on startup and always run in background.
If it's just a daemon and you only need it to "run and forget it", you can setup a cron task like this:
Code:
@reboot root /path/to/executable


EDIT: Oops... I'm setting this up as if it's a vanilla Linux system. Can probably just use System Settings -> Advanced -> Init/Shutdown Scripts or Cron Jobs
 
Last edited:

MrJoki007

Dabbler
Joined
Jul 15, 2018
Messages
45
Depending on how you need to manage it while it runs, it may be best to start it with tmux, so it can be accessed/viewed and/or managed while running and will not be subject to stopping if the middleware crashes.

You would set up a startup/init command.

Like this:
tmux new-session -d -s myexecutable '/mnt/pool/dataset/executable'
Thank you.
The way with tmux works perfectly.
 
Top