# How to rerun /etc/rc.conf



## Alain De Vos (Jun 19, 2021)

I've edited rc.conf.
How to rerun /etc/rc.conf in order for the new services to be started.
[Offcourse I can service X onestart but that's not the idea, it's to test for syntactical errors in rc.conf ]


----------



## SirDice (Jun 19, 2021)

rc.conf isn't run, it's sourced, several times, by scripts in /etc/rc.d (and /usr/local/etc/rc.d/). If you want to start a service just start it. 


Alain De Vos said:


> I can service X onestart


`service <servicename> onestart` is for starting services that _haven't_ been enabled in rc.conf. 




Alain De Vos said:


> it's to test for syntactical errors in rc.conf


There's nothing "standard" that could test it. But it's just a shell script with variables. So running `sh -x /etc/rc.conf` shouldn't produce errors.


----------



## CuatroTorres (Jun 19, 2021)

I'm not sure about this: `sysrc -c`.

Related:








						Python script which checks for syntax error in rc.conf
					

Hello all,  I have made a simple Python scripts which checks your rc.conf file for syntax errors (basically it checks all the lines in the file and output the ones which contain syntax errors).  The script itself is very simple but I guess that many people will find it useful (I am pretty...




					forums.freebsd.org


----------



## datasmurf (Jun 19, 2021)

I would go for.

`service -R`


----------



## Alain De Vos (Jun 19, 2021)

datasmurf said:


> I would go for.
> 
> `service -R`


Interesting.
It seems with mariadb, mysql_server_enable="YES" does not start. I've added "service mysql-server onestart" to rc.conf, and that works.


----------



## mer (Jun 19, 2021)

Alain De Vos said:


> It seems with mariadb, mysql_server_enable="YES" does not start. I've added "service mysql-server onestart" to rc.conf, and that works.


The second sentence seems like the wrong thing to do.
I would double check the exact syntax/form of the variable.    You should be able to look in the actual script file to find out what it's looking for.  The script "mysql-server" most likely exists in /usr/local/etc/rc.d not in /etc/rc.d.  Look for the line that starts with "rcvar"


----------



## Alain De Vos (Jun 19, 2021)

Note mysql-server has minus in the name in /usr/local/etc/rc.d and underscore in rc.conf. Maybe thats why mariadb does not get started.


----------



## mer (Jun 19, 2021)

Alain De Vos said:


> Note mysql-server has minus in the name in /usr/local/etc/rc.d and underscore in rc.conf. Maybe thats why mariadb does not get started.


Yes and if you go look at the source of the script, look for the line starting with "rcvar" and you will find the exact name of the variable it's looking for.


----------



## Alain De Vos (Jun 19, 2021)

rcvar=mysql_enable
Weird it did not started.


----------



## mer (Jun 19, 2021)

If a logfile is created, look for clues in there.


----------



## Alain De Vos (Jun 19, 2021)

I had in rc.conf "mysql_server_enable" instead of "mysql_enable". Huge difference. rcvar saved the day.


----------



## mer (Jun 19, 2021)

And now you know what to look for on the next one.


----------



## grahamperrin@ (Jun 26, 2021)

Alain De Vos said:


> … rerun /etc/rc.conf …



Comprehensively:

exit things, quit things, gracefully – save any unsaved work
some applications continue to run after disappeareance – I use sysutils/htop and *F4* to tell the truth
await ends of runs
`shutdown now`
key *Enter* or *Return*
`exit` to multi-user mode.


----------

