Ask Your Question
1

Autostart Scripts in Fedora 24.

asked 2016-06-28 23:19:24 -0500

PseudoDev gravatar image

hello there!

I have updated to fedora 24. The resolution of my pc was locked at 1024x786 for some reason and i have given up trying to fix it. anyways, xrandr is a good work around but i have to execute the scripts everytime after start up. I looked upon this thread upon starting files on startup. But it didn't work! Where did i go wrong?

Here's what i did:

Created a file named res.sh file in "/etc/init.d/" Then, made it executable by using "chmod +x /etc/init.d/res.sh" Also, these are the lines i added in the res.sh file:

Pastebin copy of my res.sh

Where did i go wrong!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-06-29 04:34:12 -0500

wulfara gravatar image

Hi. Try this:

Create a file with .desktop extension in your ~/.config/autostart/ something like '~/.config/autostart/resfix.desktop'

Edit that file to look like this:

[Desktop Entry]
Name=Resolution Fix
Exec=/home/youruser/scripts/resfix.sh
Terminal=true
Type=Application

Change the "Exec" line to match the path of your script. If the script is placed inside your home write the full path (for me it doesn't work if I use "~/..." insted of "/home/myuser/...").

This only works if the script is executable by your user without sudo but as far as I know xrandr can be executed without root access level.

Hope this helps.

edit flag offensive delete link more

Comments

Executable? So you mean i need to chmod +x it befor using?

PseudoDev gravatar imagePseudoDev ( 2016-06-29 11:02:31 -0500 )edit

The ".desktop" file doesn't need to be +x, the ".sh" file does

wulfara gravatar imagewulfara ( 2016-06-29 11:19:28 -0500 )edit

You, Sir, are a genius! It worked. Anyways, the whole point of doing what i did earlier to make the commands run as root and make it available for all users. Any idea why that didnt work?

PseudoDev gravatar imagePseudoDev ( 2016-06-29 21:40:38 -0500 )edit
1

I'm happy I helped :) To autorun root scripts at boot you have to create your own systemd service: - Create a file .service file under /etc/systemd/system something like /etc/systemd/system/resfix.service - Fill it like this:

[Unit]
Description=Resolution fix

[Service]
Type=oneshot
ExecStart=/path/to/your/script.sh

[Install]
WantedBy=multi-user.target
  • Enable: systemctl enable resfix.service and reboot. But I'm not a systemd expert and I don't know if that will run after X server does.
wulfara gravatar imagewulfara ( 2016-06-30 03:04:56 -0500 )edit

Another option is to place your res.sh script somewhere readable by everybody like /usr/local/bin/ and duplicate my first answer for each user (create ~/.config/autorun/resfix.desktop for everybody). Make sure that res.sh is readable and execubable by everybody chmod +rx res.sh

wulfara gravatar imagewulfara ( 2016-06-30 03:18:46 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-06-28 23:19:24 -0500

Seen: 8,679 times

Last updated: Jun 28 '16