I have a simple series of commands combined into 1 bash script so I can input several lines into the command prompt at once. How would I schedule this bash script to run automatically once my server has booted up?
Cheers
Ben
I have a simple series of commands combined into 1 bash script so I can input several lines into the command prompt at once. How would I schedule this bash script to run automatically once my server has booted up?
Cheers
Ben
add it to the according runlevels --> http://www.debuntu.org/how-to-manage...th-update-rc.d
Will take a look at that, thanks!
Ok, so I copied the script to /etc/init.d/ and ranand when I reboot it doesn't run.Code:update-rc.d myscript defaults
Any ideas?
it might requier a structure of an init script... if that does not help, you can still attach the script to your autostart - or is it required to run as root?
This is the script:
I'm sick of remounting the USB hard drives everytime I reboot so I jsut chucked the commands into 1 file with the intnetion of running 1 command instead of 5 every reboot.Code:#! /bin/bash # script to mount drives and share sudo mount /dev/sdb1 /media/disk sudo mount /dev/sdc1 /media/disk-1 sudo mount /dev/sdd1 /media/disk-2 sudo mount /home/user/shared sudo mount -a
What do you think?
why don't you mount them in the /etc/fstab?
That just gave me loads of problems and I couldn't get it to work. Also, the machine keeps switching the order of which one is sdb1, which is sdc1 and sdd1 etc, so mounting them manually is the only way I've been able to reliably mount them where I want them to be. Either running the script manually, or typinggets the drives to mount up, but is there any way to do this automatically?Code:sudo /etc/init.d/myscript start
if you have a script in the init.rd then you don't need a sudo, it will be run as root...
but I think you'll need to put it into an init like script...
Right, will take a look at that!
Cheers for your help!
Bookmarks