Artix Linux Forum

Artix Linux => Applications & Software => Topic started by: Everyone on 12 December 2017, 10:49:14

Title: How to autorun?
Post by: Everyone on 12 December 2017, 10:49:14
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.
Title: Re: How to autorun?
Post by: Chris Cromer on 12 December 2017, 17:54:18
OpenRC services can be started with:
Code: [Select]
# rc-service servicenamehere start

they can be enabled with:
OpenRC services can be started with:
Code: [Select]
# rc-update add servicenamehere runlevel

The default run level is called "default" but you can create other run levels if you desire.
Title: Re: How to autorun?
Post by: Everyone on 12 December 2017, 20:36:52
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?
Title: Re: How to autorun?
Post by: Chris Cromer on 12 December 2017, 21:00:00
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:
Code: [Select]
# rc-service nginx start
Title: Re: How to autorun?
Post by: thefallenrat on 12 December 2017, 21:57:18
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

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
Title: Re: How to autorun?
Post by: Everyone on 12 December 2017, 22:51:37
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?
Title: Re: How to autorun?
Post by: thefallenrat on 13 December 2017, 00:41:39
I'm not sure what you meant, as the file in your link seems to have the same contents as cromer's,

Wrong link, I meant this https://gitweb.gentoo.org/repo/gentoo.git/plain/www-servers/nginx/files/nginx.conf-r2
Title: Re: How to autorun?
Post by: Chris Cromer on 13 December 2017, 01:14:29
I think what should be saved as /etc/conf.d/nginx is this (https://gitweb.gentoo.org/repo/gentoo.git/plain/www-servers/nginx/files/nginx.conf-r2). That file should be placed in /etc/nginx/nginx.conf instead

But fret not, for I will add these to artix repo soon
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.
Title: Re: How to autorun?
Post by: thefallenrat on 13 December 2017, 01:38:33
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