12-2 - Place to put a script ran at startup

Hello.

I plane to use an include script ( which will be specified in rsyslog.conf ).
I would like to run a shell script as early as possible before rsyslog start.

#!/bin/bash
#
cp /etc/rsyslog.inc.start  /etc/rsylog.inc


and add in crontab

*/5   * * * *   root  /root/bin/restart_rsyslog >/dev/null 2>&1

Which should contain :

#!/bin/bash
#

cp /etc/rsyslog.inc.post-start  /etc/rsylog.inc
service syslog restart


Because I need top change message format after startup if finished.
.

I am not sure I understand what you want, but you can add commands to the after.local script if you like to be run as root. Have a look at this blog on getting this script to work at startup.

systemd and using the after.local script in openSUSE 12.1/12.2 - Blogs - openSUSE Forums

Thank You,

On 2012-11-13 19:46, jcdole wrote:
> Because I need top change message format after startup if finished.

You want to start with one format, and then continue with another? Why
not all the time with the alternate format?


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” (Minas Tirith))

Because the alternate format is not suitable during boot time

On 2012-11-14 10:16, jcdole wrote:
>
> robin_listas;2503627 Wrote:
>> On 2012-11-13 19:46, jcdole wrote:
>>> Because I need top change message format after startup if finished.
>>
>> You want to start with one format, and then continue with another? Why
>> not all the time with the alternate format?

> Because the alternate format is not suitable during boot time

Why not? I don’t understand. Could you give samples?

I say this because the spirit of a help forum is to help on the root
cause of problems, which is not the same as what people usually ask for
thinking that it is the solution for the problem. I think that altering
the syslog format dynamically may bomb out some time.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” (Minas Tirith))

Hello.

Here is the sample : SUSE Paste

When the server stops, initial text format is reset by putting the good data in the include file use by rsyslog (/etc/rsyslog.d). This is done by a command that I have inserted in /etc/init.d/halt.local.
During the next start, rsyslog read the config file /etc/rsyslog.conf and all the conf file in (/etc/rsyslog.d).

During the boot sequence, /etc/init.d/after.local is executed ( the service has been created using jdmcdaniel3 script )
This script wait 5 minutes then set the new text format by putting the new config data in the include file use by rsyslog, then restart syslog. Restarting syslog force the new text format in use.

It’s running exactly as I expected.

Thank you for taking time to help me.