Score:0

How do I create a systemd timer job to edit a file in /etc?

bd flag

I have a Python script that writes to a file in /etc/software. In order to write to that file you need sudo. I tested the script and it works / writes to the file when using sudo.

I want to create a systemd timer job - different people call these different things.. I want to create a service unit tied to a timer unit. The service should run my Python script using a privileged account.

I just don't know how to achieve this. I need this in /etc/systemd/system because I need this to run for a piece of system wide software and even when logged off. I assume I need a privileged account, is that right? How would I create one?

My Python script gathers some API info and writes to basically /etc/software/bigrig.conf. I just need to know how to create the systemd timer service piece and how to create a privileged account that can write to the file in /etc / to run the service as in general.

Thanks.

David avatar
cn flag
What version of Ubuntu? Server, Desktop or Core?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.