OESF Portables Forum

Everything Else => General Support and Discussion => Zaurus General Forums => Archived Forums => Software => Topic started by: jason123 on June 06, 2004, 08:27:25 pm

Title: Swapfile startup scripting
Post by: jason123 on June 06, 2004, 08:27:25 pm
I\'d really like to have a script that launches from qpe.sh that does the following:

1. determines whether or not there is a swapfile on /mnt/card/
    if there is not, creates an 8mb swapfile and
2. activates the swapfile.


But I\'m not really a scriptwriter, I have been using setswap.sh, the one that you find online .. but it just creates the swapfile each time, I\'d also like it to echo what it is doing ie \"Writing 8mb swapfile to /mnt/card/\"
but so far I haven\'t been able to get any output from echoing that in qpe.sh -- or in setswap.sh.

Does anyone want to assist me in this venture?  I wouldn\'t think its that hard, I\'m just lame.
Title: Swapfile startup scripting
Post by: Zazz on June 06, 2004, 08:49:38 pm
test -e /mnt/card/swapfile || (echo Creating swapfile... &&
  dd if=/dev/zero of=/mnt/card/swapfile bs=1024k count=8 &&
  mkswap /mnt/card/swapfile)
swapon /mnt/card/swapfile

You can make it more verbose if you like to.
Title: Swapfile startup scripting
Post by: jason123 on June 06, 2004, 09:14:03 pm
when i try that it also seems to generate the swapfile each time, if one already exists (which in my case it should) I\'d really like it to skip the mkswap step.
Title: Swapfile startup scripting
Post by: Zazz on June 06, 2004, 09:27:00 pm
Quote
when i try that it also seems to generate the swapfile each time, if one already exists (which in my case it should)


Are you sure you copied the lines correctly?

What is the output of

test -e /mnt/card/swapfile && echo Swapfile exists || echo Swapfile does not exist

for existing or non-existing swapfile?

You could also try different test commands, the bash builtin one and the external one if it exists though it should really not make a difference.
Title: Swapfile startup scripting
Post by: jason123 on June 06, 2004, 09:44:24 pm
ok -- I screwed up -- it works!  thanks!  still no output when I\'m starting up though -- i just get a little white blinking cursor
Title: Swapfile startup scripting
Post by: cmisip on June 07, 2004, 09:24:39 pm
Get rc.local running at startup
Then put this in it:

dmesg | grep \"Adding Swap\"