General NAS-Central Forums

Welcome to the NAS community
It is currently Wed Nov 22, 2017 11:56 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: S09swap
PostPosted: Mon May 30, 2011 10:22 am 
Offline

Joined: Mon May 30, 2011 10:14 am
Posts: 3
Hello,

I have been busy with my NS, i have it hacked, with telnet active. It's a low RAM device, and this often results in my samba or proftpd in being killed by the OOM when i am copying something.

I found the kernel parameters in /proc/sys/vm, swappiness, min_free_kbytes, and memory_overcommit. When i changed those, the swappiness increased, and my process wasnt often being killing anymore. However, these values were being restored to original when the device reboots.

I put the commands to change those values in the S09swap script, to activate them at bootup. That worked a bit for me, as the values still were changed at every bootup. Now somehow, i think by pressing a wrong button, the S09swap script went empty. the swapfile isnt even being mounted anymore, and my NS is kind of screwed, as the memory killer is busy at any time.

Is there someone who can post the original S09swap script?

p.s. I tried to install sysctl via ipkg (ipkg install busybox), but my ipkg returned a wget error in any command i tried. So far i didnt manage to get programs via ipkg.

Thanks in advance!


Top
 Profile  
 
 Post subject: Re: S09swap
PostPosted: Mon May 30, 2011 6:07 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6074
Code:
#!/bin/sh
# Begin $rc_base/init.d/swap - Swap Control Script

# Written by Gerard Beekmans  - gerard@linuxfromscratch.org

. /etc/sysconfig/rc
. $rc_functions

case "$1" in
        start)
                echo "Activating all swap files/partitions..."
                swapon -a
                if [ x"$?" = x"1" ]
                then
                        swapoff -a
                        for swapdev in `cat /etc/fstab | grep swap | awk '{print $1}'`
                        do
                                mkswap $swapdev                 
                                swapon $swapdev
                        done
                fi
                evaluate_retval
                ;;

        stop)
                echo "Deactivating all swap files/partitions..."
                swapoff -a
                evaluate_retval
                ;;

        restart)
                $0 stop
                sleep 1
                $0 start
                ;;

        *)
                echo "Usage: $0 {start|stop|restart|status}"
                exit 1
                ;;
esac

# End $rc_base/init.d/swap


Top
 Profile  
 
 Post subject: Re: S09swap
PostPosted: Tue May 31, 2011 11:52 am 
Offline

Joined: Mon May 30, 2011 10:14 am
Posts: 3
thank you very much Mijzelf.

That was the script i needed.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group