Intelligent start



  • Hello,

    I hope for your kind suggestions and opinion about how much sense makes the following problem solution.

    Pfsense starts after every boot with its own standard config: syslog.conf, crontabs etc.

    I adapted pfsense 3.1.5 to my needs: cron jobs with backup of logs and piping of log-messages into my own files in special. I had to change the two mentioned files. Unfortunately, I found, the changes disappear after a reboot.

    So I attacked the /etc/inc/system.inc but because of its complexity for me as a beginner I search for a simpler solution.

    The solution is to replace the two files at bootup with my own versions.

    Now I'm not sure, when to invoke the change (earlyshellcmd or shellcmd). Thus I'd like to place as a shellcmd (using the shellcmd-package) a "replacement.sh" that replaces the files. Before it happens, I want to kill the cron-job and the syslog-job. Afterwards I'd like to restart them.

    What do you think about this solution please. Did I ignore something important?

    Best wishes
    Michael



  • Hello again,

    I tried my best and the solution qua replacement-script of the files that are renewed at every boot seems to work.
    I placed the script into /usr/local/etc/rc.c. It looks like that:

    #!/bin/sh
    
    kill -9 $(cat /var/run/syslog.pid)
    cp /root/Skripte/syslog.conf_ersatz /etc/syslog.conf
    /usr/sbin/syslogd -s -c -c -l /var/dhcpd/var/run/log -f /var/etc/syslog.conf
    
    kill -9 $(cat /var/run/cron.pid)
    cp /root/Skripte/crontab_ersatz /etc/crontab
    /usr/sbin/cron -s
    

    Best wishes
    Michael


Log in to reply