2

According to linuxaudio.org, I should add the command echo 3072 >/sys/class/rtc/rtc0/max_user_freq to my startup scripts.

In previous versions, I've done this by adding the line to the file /etc/rc.local, however as I understand, this does not work in 18.04 anymore.

Then, I found an answer that mentions creating a startup script in /etc/systemd/system/ like so:

[Unit]
Description=RTC Max User Freq

[Service]
ExecStart=echo 3072 >/sys/class/rtc/rtc0/max_user_freq
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

The script was found by the systemctl autocomplete command and I enabled it successfully, however it does not come into effect upon reboot.

What do I have to do in Ubuntu 18.04 to execute this command on startup?

Edit: The solution to this issue is a simple syntax change, the code in the .service-file when using systemd to run the script on startup should actually be:

[Unit]
Description=RTC Max User Freq

[Service]
ExecStart=/bin/bash -c "echo 3072 >/sys/class/rtc/rtc0/max_user_freq"
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

After wrapping the command in /bin/bash -c "...", the script worked immediately.

  • 1
    Wrap that in a shell and you should be good to go. – muru Dec 16 '18 at 04:31
  • @muru, thank you for the link - wrapping the command was the way to do it, but how is this a duplicate question? By the phrasing of the one you've linked, I'd never have found the answer. – Prototype700 Dec 16 '18 at 11:55
  • @dessert, that did not work, unfortunately. I had to wrap the command in /bin/bash -c "...", also, the question you linked was exactly where I got my code sample above, which didn't work just like that. – Prototype700 Dec 16 '18 at 11:56
  • 1
    @Prototype700 that's the point of duplicates, isn't it? Different phrasings of the same underlying question. – muru Dec 16 '18 at 11:56
  • @muru, well yes, but how is this the same underlying question? The person was asking about how they can use wild cards to run a series of Java-files specifically in systemd. I needed to execute a one-line command on start and didn't demand to use systemd to accomplish this, I just added the code sample, because that's the point where I was at. I read the suggestions while creating this question and had I read the other one, I wouldn't have assumed to find an answer there. – Prototype700 Dec 16 '18 at 12:05
  • 1
    @Prototype700 they're both about using parts of shell syntax. That could be wildcards (that question), redirection (your question), pipes (example from manpage in my answer to that question), brace expansion, who knows what else, etc. – muru Dec 16 '18 at 12:07
  • @muru, okay. I still think that this is a confusing way of handling "duplicates" in that sense on this platform, but that's not your fault. At least your answer gave the missing clue immediately, so thanks again. I'll edit this question so that anyone who finds it randomly gets the answer right away. – Prototype700 Dec 16 '18 at 12:13
  • 1
    @Prototype700 I edited the dupe's title. – muru Dec 16 '18 at 12:14

0 Answers0