We can upgrade fedora with rpm-ostree using the command `rpm-ostree upgrade`. Also we can do the same with a shell script. For upgrading I have made a shell script (autoupdate.sh) as shown in this link. Accrding to the script first I check the network connection and then if the network connection is found, it starts to upgrade.

To automate the upgrading, I thought using a system service is a easy and better way. So I have created a service file (autoupdate.service) as shown in this link. To test the codes, I have created the autoupdate.sh file on /usr/local/bin/ location. And the autoupdate.service at /etc/systemd/system/ location.


Then you need to make this files executable.
To make autoupdate.sh file executable, run the following command;

chmod +x /usr/local/bin/autoupdate.sh
Then you need to setup the service file. To do so, you need to run following commands as follows;
touch /etc/systemd/system/autoupdate.service
chmod 664 /etc/systemd/system/autoupdate.service.

with the above commands you have now setup the service file as executable. To start the service you can use the following command;

systemctl daemon-reload
systemctl start autoupdate.service

To stop the service you can use the following command;

systemctl stop autoupdate.service

To check the status you can use the following command;

systemctl status autoupdate.service

To add the service to be auto run when the system is rebooted;

systemctl enable autoupdate.service

To disable the service auto running after rebooting;

systemctl disable autoupdate.service

After enabling autoupdate.service to run automatically, fedora will be able to auto upgrade the system when a new fedora image is released!

So, why still upgrading manually? Lets upgrade fedora automatically! 

***Please note that all of the content on this post was originally published on champlnx.blogspot.com. We have migrated these posts to www.champlnx.com for your convenience and continued access.

Leave a Reply

Your email address will not be published. Required fields are marked *