For servers which running dynamic IP, can use this set of scripts to report new IP to specific owner email.
- Client instance: Put /script/ into the server which you wish to report its new IP when reboot.
- Service instance: put /php/ into any server which allowed PHP Web access.
- customize the params that use to trigger your mailing action.
- do remember to change the
$emailAddress
and$emailTitle
as you wish. - make sure your php mail command is usable.
- execute the command:
chmod +x /etc/rc.local
- add following code into last new row of rc.local:
sh /script/mailOnReboot.sh &
- amend
URL
,KEY
andPARAM_KEY
in the script file as your desired. Must match with the param configured in PHP script.
- perform restart with command line, an email should received:
shutdown -r now