How to add executable bash script on ubuntu startup [duplicate]

I have created a executable bash script (using chmod +x) for monitoring my system and it works perfectly with out any error. Now i want to add this script on my start up in order to executing the script on every reboot. I have saved this executable file in my documents folder like this

/home/user/Documents/file.sh

For running this script on start up; from dash i searched and selected "Startup Applications" and added the details and location of the script and done a fresh reboot. But even after a fresh reboot the script is not working but the script is executing when i do it with terminal (eg ./file.sh). What changes should i make it to run my script on start up. If it helps this is the attribute of my script

-rwxrwxr-x ;using ls -l

One more option is schedule a job at boot time

crontab -e

Choose an editor to open the cron job file. Append the following with your script name

@reboot path/to/script.sh

In your case

crontab -e

@reboot /home/user/Documents/file.sh

Make sure the script has executable permission.


So I have succesfully run the script using my method itself (System > Preferences > Startup Applications). These are the changes I made to my script.

Added this line at the top of my script

#!/bin/bash

Then made executable using this command

chmod u+x file.sh

rebooted the system