summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorwchang kim <wchang.kim@samsung.com>2016-07-05 14:43:02 +0900
committerwchang kim <wchang.kim@samsung.com>2016-07-05 14:43:02 +0900
commit5c851825b27703797bda2dfa292f568c0612a4e0 (patch)
tree525564cb4652cbc409530e6b871447ff181657b1 /scripts
parentd0b08988e334877e07c0082d61c4c392f90a290f (diff)
downloadsystem-plugin-5c851825b27703797bda2dfa292f568c0612a4e0.tar.gz
system-plugin-5c851825b27703797bda2dfa292f568c0612a4e0.tar.bz2
system-plugin-5c851825b27703797bda2dfa292f568c0612a4e0.zip
Adding a service for fstrim for opt mount. Requested by profiling part. Change-Id: I4da82cf6e5979cc57f56e0db69723b177de1a050 Signed-off-by: Woochang Kim <wchang.kim@samsung.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/tizen-fstrim-on-charge.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/scripts/tizen-fstrim-on-charge.sh b/scripts/tizen-fstrim-on-charge.sh
new file mode 100644
index 0000000..c08cd74
--- /dev/null
+++ b/scripts/tizen-fstrim-on-charge.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+if [ "$#" -ne 1 ];then
+ echo "Argument was missed."
+ exit 1
+fi
+
+CHARGE_NOW_FILE=`/usr/bin/find /sys/devices -path */power_supply/battery/charge_now`
+if [ "x$CHARGE_NOW_FILE" == "x" ]; then
+ echo "Can not find 'charge_now'."
+ CHARGE_NOW_VALUE=0
+else
+ CHARGE_NOW_VALUE=`/bin/cat $CHARGE_NOW_FILE`
+fi
+
+BATTERY_STATUS_FILE=`/usr/bin/find /sys/devices -path */power_supply/battery/status`
+if [ "x$BATTERY_STATUS_FILE" == "x" ]; then
+ echo "Can not find 'status'."
+ exit 1
+else
+ STATUS_VALUE=`/bin/cat $BATTERY_STATUS_FILE`
+fi
+
+BATTERY_CAPACITY_FILE=`/usr/bin/find /sys/devices -path */power_supply/battery/capacity`
+if [ "x$BATTERY_CAPACITY_FILE" == "x" ]; then
+ echo "Can not find 'capacity'."
+ exit 1
+else
+ CAPACITY_VALUE=`/bin/cat $BATTERY_CAPACITY_FILE`
+fi
+
+echo $STATUS_VALUE
+echo $CAPACITY_VALUE
+
+if [ "$CHARGE_NOW_VALUE" -gt 0 ];then
+ echo "Do fstrim(C1)."
+ /sbin/fstrim -v $*
+else
+ if [ \( $STATUS_VALUE == "Charging" -o $STATUS_VALUE == "Full" \) -a \( $CAPACITY_VALUE -gt 30 \) ]; then
+ echo "Do fstrim(C2)."
+ /sbin/fstrim -v $*
+ else
+ echo "Not on charging."
+ fi
+fi