I've put Artix as my home server OS with the aim of retiring the TomatoWRT router and installed the usual server stuff like nginx and php. I noticed that when restarting the box they do not autorun by themselves. What would be the correct way to achieve that? Do I write an OpenRC service file and add it to a runlevel? I could use some pointers to the right info.
OpenRC services can be started with:
# rc-service servicenamehere start
they can be enabled with:
OpenRC services can be started with:
# rc-update add servicenamehere runlevel
The default run level is called "default" but you can create other run levels if you desire.
The thing is nothing like an nginx service or php service was created when installing the packages, and that's where my question comes in - do I make the service files on my own? Or are there other, maybe more proper mechanisms to make things autostart?
In this case, it is because the service script is not yet in our repos. What you can do is download the init file:
https://gitweb.gentoo.org/repo/gentoo.git/plain/www-servers/nginx/files/nginx.initd-r4 (https://gitweb.gentoo.org/repo/gentoo.git/plain/www-servers/nginx/files/nginx.initd-r4) and save its contents to /etc/init.d/nginx
then download the conf file:
https://gitweb.gentoo.org/repo/gentoo.git/plain/www-servers/nginx/files/nginx.confd (https://gitweb.gentoo.org/repo/gentoo.git/plain/www-servers/nginx/files/nginx.confd) and save its contents to /etc/conf.d/nginx
Make sure the chmod /etc/init.d/nginx as 755 to allow it to be executed. After that you can start it with the same commands I posted previously such as:
# rc-service nginx start
I think what should be saved as
/etc/conf.d/nginx is [https://gitweb.gentoo.org/repo/gentoo.git/plain/www-servers/nginx/files/nginx.confd[/i] instead
But fret not, for I will add these to artix repo soon
Thank you both. thefallenrat, I'm not sure what you meant, as the file in your link seems to have the same contents as cromer's, neverthless I've put the files in (i hope) right places, checked the privileges and all seems to work. Nginx's config is not a problem.
Is it safe to assume that if a package does not come with service files then they can be taken from gentoo if needed?
Wrong link, I meant this https://gitweb.gentoo.org/repo/gentoo.git/plain/www-servers/nginx/files/nginx.conf-r2
No, that is incorrect. The one I linked goes in /etc/conf.d/nginx, the one you linked goes in /etc/nginx/nginx.conf
The one I linked is the configuration for the init script, the one you linked is the configuration for nginx itself.
Okay I messed up :
My initial thought was
confd (https://gitweb.gentoo.org/repo/gentoo.git/plain/www-servers/nginx/files/nginx.confd) was put in /etc/conf.d/nginx
nginx.conf-r2 (https://gitweb.gentoo.org/repo/gentoo.git/plain/www-servers/nginx/files/nginx.conf-r2) was put in /etc/nginx/nginx.conf
Don't know how it messed up this time, I'm sorry
But anyway I just added both nginx (https://github.com/artix-linux/world/commit/0bd25bdbd7fa5527be9b85320202a677f9b6cfb7) ( no systemd ) and its init scripts (https://github.com/artix-linux/world/commit/5d7cdb75a8475305b84c27a9cba49799643b98a4) on artix testing repo
Enjoy