2

I am new to Ubuntu.I want to run this script every time my system reboots.Is there a way to do that?Thanks in advance for help.

# !/bin/bash
#fix resolution problem
xrandr --newmode "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934  -   hsync +vsync   
xrandr --addmode VGA1 1440x900_60.00
akshay
  • 149

3 Answers3

0

To execute a script upon reboot:

  1. Put your script in /etc/rc0.d
  2. Make it executable: sudo chmod +x K99_script
  3. Notes:
    • The scripts in this directory are executed in alphabetical order.
    • The name of your script must begin with K99 to run at the right time.
M.Tarun
  • 5,121
0

You can create a cron job using the special string @reboot.

Make sure your script is executable.

Run crontab -e (if it requires sudo privleges use sudo crontab -e to edit root's crontab)

Your crontab command should look like: @reboot /path/to/script.sh

Dan
  • 6,784
0

First of all make your file executable by using this command :

chmod +x file_name

after you go to the file location

then add this line to

/etc/rc.local

here is the line:

/path/to/file/file_name

next time you restart your PC i think it will work well.