How to set a program to run on startup + how do I copy files into the jail?

solonovamax

Cadet
Joined
Apr 14, 2019
Messages
9
Hey,

This is my first time working with jails, so I have no clue what I'm doing.
Basically, I'm trying to make a file (bot.js) run automatically every time the jails starts up (which should happen automatically, when the NAS starts. That part I figured out.). I intend to use this for a discord bot, which I would like to run 24/7. It uses node.js, and discord.js I would like to be able to do it using nodemon (apparently nodemon wont install on the jail using npm install nodemon)

Additionally, I can't seem to copy files into the jail. I set the jail to be a file share, and I made sure all my perms were enabled, but I can't seem to do it for some reason. I've tried to ssh into the nas, then using mv to move the files. I can't figure out how that works.



If I missed anything, please feel free to tell me, and I'll update you as soon as I can
Thanks for your time,
~solonovamax
 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
Have you tried putting it into the crontab of the jail?
 

solonovamax

Cadet
Joined
Apr 14, 2019
Messages
9
Have you tried putting it into the crontab of the jail?
I don't understand what you mean by this. A cron job is not what I'm looking for, as I'm trying to run a node.js program, which is installed within the jail and not on any other part of the nas.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I can't seem to copy files into the jail.
The ordinary way of giving jails access to data on the server is by adding a mountpoint to the jail, which makes a specified directory on the NAS available inside the jail at a specified path.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
A cron job is not what I'm looking for, as I'm trying to run a node.js program, which is installed within the jail and not on any other part of the nas.
...which you can do in a cron job (though I wouldn't think it's the best way to do it). Why do you believe otherwise?
 

solonovamax

Cadet
Joined
Apr 14, 2019
Messages
9
...which you can do in a cron job (though I wouldn't think it's the best way to do it). Why do you believe otherwise?
Well, I though a cron job wouldn't work, as it requires node.js and discord.js to run.
Though I don't really know much about FreeNAS, I just assumed that it wouldn't be able to load node.js.
 

nojohnny101

Wizard
Joined
Dec 3, 2015
Messages
1,478
You can set @Reboot in the crontab
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Though I don't really know much about FreeNAS, I just assumed that it wouldn't be able to load node.js.
FreeNAS itself can't. But your jail should be able to--if it can't, you'll need to install it there.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
You can set @Reboot in the crontab
Indeed you can--but I'd think putting it in /etc/rc.local would be the better way to go. But as is often the case, there's more than one way to skin this cat.
 
Top