How to run script automatically on reboot as root user?

Hi friends,,,

I am running one server on Ubuntu 12.04 LTS 32-bit, some times my pc restarts automatically, with no reason, I have a script to start server which requires root password. in this directory

/myserver/start_server.sh

How can I do this ?

and some scripts I am having that I need to run daily once around 10.00 Am, for these scripts I need to change ownership from root to user in

 /dev/bull

while running script

If you have cron running, you can add this line to root's crontab by running crontab -e as root:

@reboot /path/to/myscript

to have cron run your script on boot.

Beware that cron gives a minimal path. You may want to add . /etc/profile as one of the first lines in your script to ensure it can find all the common commands.

If you want to change permissions on devices, do so with udev's own config files, not manually changing them with a script -- udev is the system that sets the permissions in the first place, and may undo manual changes on a whim. On my system they're in /etc/udev/rules.d/ but YMMV.

Perhaps a udev rule like this:

KERNEL=="bull", GROUP="mygroup", MODE=0660

...matching the name the kernel (not /dev) gives it, assigning it to 'mygroup', and giving it group read-write permissions.