mailreport - extra 'boot completed' time option?
-
I'd love to see the ability to send an email 'boot completed', this would be immensely helpful to send diagnostic information e.g. IP info etc after a reboot from the mailreport package directly. If this isn't the right place for suggestions I apologize!
-
@incith
You can configure a report mail, save it and edit the cron entry to be processed on bootup after. -
What about the shellcmd package ?
You can write a simple script that includes whatever you want, and send the mail using the pfSense mail notification system.
-
I get a "bootup complete" message, but darned if I can figure out where it's switched on. If not in the GUI, must be some script I read about here.
-
-
@viragomann
I don't think so. I just built myself a fresh 2.5.2 yesterday and only imported my config.xml. Must be in there somewhere, just not seeing it. -
@provels said in mailreport - extra 'boot completed' time option?:
but darned if I can figure out where it's switched on
pfSense physically ?
That would be like remembering things before your parents got the idea of 'instantiating' you.pfSense wasn't there was it was put on neither.
Or do you mean : an example of the script ?
Sure :<?php require_once("pkg-utils.inc"); require_once("notices.inc"); require_once("util.inc"); $msg ="Put in here whatever you want.\n"; $msg .="You can even use known variables from the config or 'g' array\n"; if (!empty($msg)) { notify_via_smtp($msg); } // log_error("StarCmd == bootup Mail send"); ?>
Your only limitation is your imagination ;)
Put this file in /root/yourboot.php
Create a Startcmd entry like :
/usr/local/bin/php-cgi -f /root/yourboot.phpType is startcmd, not earlycmd
And your good.
-
@gertjan
Sorry if I wasn't clear. I already get a "bootup complete" email notification. Maybe it's built-in to the stock notifications if they are configured, as I made no config changes after building a new VM. Only restored my config.xml.Or perhaps I misunderstood the original poster. Always a possibility.
-
@provels said in mailreport - extra 'boot completed' time option?:
I already get a "bootup complete" email notification.
We all do.
That is, if the notification system has at least one of the smtp/telegram/whatever already working.It's the last line of the all might /etc/rc.bootup that sends this notification message. It's this file that tells pfSense that it is pfSense and not some vanilla 'FreeBSD' device.