|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 Code:
/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 Code:
/dev/bull while running script |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
If you have cron running, you can add this line to root's crontab by running
crontab -e as root: Code:
@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: Code:
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. Last edited by Corona688; 02-14-2013 at 12:51 PM.. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script to run commands as root user | Siddheshk | Shell Programming and Scripting | 2 | 02-08-2013 06:47 AM |
| Need to run a bash script that logs on as a non-root user and runs script as root | damang111 | Shell Programming and Scripting | 2 | 12-23-2011 10:53 PM |
| Get current logged in user from a script run as root. | hakermania | Shell Programming and Scripting | 7 | 08-18-2010 09:47 AM |
| How a normal user run a script including root privileaged commands | initin | Shell Programming and Scripting | 7 | 01-20-2009 01:59 PM |
| run a script on logout by a non-root user | harsha10 | Shell Programming and Scripting | 6 | 06-16-2008 03:14 PM |
|
|