I need to download a file from an external location eg http://s3.amazonaws.com/my-bucket/config.xml and then save that file to /etc/config.xml when the server starts.
What is the best way to do this in fedora?
I assume I need some boot script as this need to be done every restart/start.
Just to clarify, the process will be:
- Server boots up
- Server downloads file from the location
- Server runs command "serivce httpd start"
You can just put the commands into
/etc/rc.local
. This script is ran at the end of the boot process, so your network interfaces and settings will have been initiated. You may have to disable the existing httpd startup script (which is probably in/etc/init.d
), by making it non executable:Or simply by moving it to another location.
More information on the boot sequence can be found at: https://wiki.archlinux.org/index.php/Arch_Boot_Process
It may not be specific to your distro, but the process is usually pretty similar on any modern distro.
you can use cron's
@reboot
directive to run a script every time your system starts up. edit/etc/crontab
As per IgnacioVazquez-Abrams comment you will need to disable httpd at startup using the chkconfig command e.g.
chkconfig httpd off
Write an initscript that runs in between
network
/NetworkManager
andhttpd
. See/usr/share/doc/initscripts-*/sysvinitfiles
for more details.