LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Script with root rights on startup - swap space initialization (https://www.linuxquestions.org/questions/linux-newbie-8/script-with-root-rights-on-startup-swap-space-initialization-199703/)

TroelsSmit 06-30-2004 10:31 PM

Script with root rights on startup - swap space initialization
 
Hi,

I would like to have a script run on startup with root rights, so I have placed the script in
/etc/init.d/
and given it execution rights - it still doesn't run on startup, what do I have to do ??

The content of the script is as follows:
swapon /home/troels/old_linux/swapfil
swapon /home/troels/old_linux/swapfil1
swapon /home/troels/old_linux/swapfil2

It basically initializes my swap space defined in /etc/fstab as follows:
/home/troels/old_linux/swapfil none swap defaults 0 0
/home/troels/old_linux/swapfil1 none swap defaults 0 0
/home/troels/old_linux/swapfil2 none swap defaults 0 0

Any comments on this procedure would be great :-)

Tinkster 06-30-2004 10:48 PM

Try
/sbin/swapon
in the script ... but why in the workd are you using 3 swap-files
rather than a swap-partition?


Cheers,
Tink

TroelsSmit 06-30-2004 11:04 PM

The script is not being run (I have an echo statement that I never see on startup) - so I don't think /sbin/swapon will help.

I use swap files because the need for futher swap space arised suddenly the other day and I was in need of a fast solution.

Thanks for the reply !

btmiller 06-30-2004 11:55 PM

Scripts in init.d don;t automatically run when the machine boot, they get run when init parses the /etc/rc.d/rc[0-6]d directories (Slackware does it slightly differently). Probably the easiest way to make your script run is jusyt add it to the rc.local file.

TroelsSmit 06-30-2004 11:58 PM

Sorry for being a newbee but 'locate rc.local' doesn't yield any results.
Exactly which file are you talking about ?
/etc/rc3... ??


All times are GMT -5. The time now is 08:30 PM.