#!/bin/sh
[ "$(whoami)" != 'root' ] && ( echo you are using a non-privileged account; exit 1 )

if  [ "$1" == 'KillAllocatingTask' ]; then echo "$2" > /proc/sys/vm/oom_kill_allocating_task; fi 
if  [ "$1" == 'PageCluster' ]; then echo "$2" > /proc/sys/vm/page-cluster; fi  
if  [ "$1" == 'LaptopMode' ]; then echo "$2" > /proc/sys/vm/laptop_mode; fi  
if  [ "$1" == 'DirtyExpireCentisecs' ]; then echo "$2" > /proc/sys/vm/dirty_expire_centisecs; fi  
if  [ "$1" == 'TCPTimestamps' ]; then echo "$2" > /proc/sys/net/ipv4/tcp_timestamps; fi  
if  [ "$1" == 'DirtyWritebackCentisecs' ]; then echo "$2" > /proc/sys/vm/dirty_writeback_centisecs; fi  
if  [ "$1" == 'TCPNoMetricsSave' ]; then echo "$2" > /proc/sys/net/ipv4/tcp_no_metrics_save; fi  
if  [ "$1" == 'DirtyRatio' ]; then echo "$2" > /proc/sys/vm/dirty_ratio; fi  
if  [ "$1" == 'Swappiness' ]; then echo "$2" > /proc/sys/vm/swappiness; fi  
if  [ "$1" == 'DirtyBGDRatio' ]; then echo "$2" > /proc/sys/vm/dirty_background_ratio; fi  
if  [ "$1" == 'VFSCachePressure' ]; then echo "$2" > /proc/sys/vm/vfs_cache_pressure; fi  

if  [ "$1" == 'copyTuning_temp' ]; then cp /home/user/.swappolube/swappolube_config_temp /etc/event.d/tuning; fi  
if  [ "$1" == 'deleteTuning' ]; then rm /etc/event.d/tuning; fi  
